LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy
User Name
Password
Puppy This forum is for the discussion of Puppy Linux.

Notices


Reply
  Search this Thread
Old 06-04-2015, 02:32 PM   #16
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918

^ your not explaining what you are trying to accomplish or the errors you are receiving very well (copy-paste of the command as well as the output would be helpful for us to help you troubleshoot).

this will create an empty file with todays date in month-day-year as the name:
Code:
[schneidz@hyper fixit]$ touch `date +%m-%d-%Y`.txt
[schneidz@hyper fixit]$ ll
total 0
-rw-rw-r--. 1 schneidz schneidz 0 Jun  4 15:32 06-04-2015.txt
[schneidz@hyper fixit]$ file 06-04-2015.txt 
06-04-2015.txt: empty
this forums software is removing the first % for some reason. i fixed it by editing the post and adding %% between + and m.

Last edited by schneidz; 06-04-2015 at 02:35 PM.
 
Old 06-04-2015, 02:51 PM   #17
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Thanks a lot.

Comment near the end shows what your script is used for.

Quote:
#!/bin/bash
#
# MUCH HELP FROM SCHNEIDZ AND MICHAELK
#
# Linux Puppy 5.9.3
# BACKUP SCRIPT FOR PUPPY 5.9.3
clear
touch -am /mnt/sdb1/Linux_Files/TOSHIBA_SDB1
touch -am /mnt/sdb5/TOSHIBA_SDB5
touch -am /mnt/sdb1/TOSHIBA_SDB1
touch -am PUPPY_SLACKO_5.9.3_SDA5
cd /
touch -am PUPPY_SLACKO_5.9.3_SDA5
cd mnt/sda2
touch -am /mnt/sda2/Linux_Mint_SDA2
touch -am /mnt/sda1/Windows_XP_Partition
#
cd /root/.mozilla/seamonkey/agi9ixk5.default/
cp -f bookmarks.html /mnt/sdb1/Linux_Files/
#
cd /root/Scripts
#
zip -u Puppy_5.9.3_Bash_Scripts.zip *.sh
# CREATE FILE THAT SHOWS WHEN BACKUP WAS DONE
rm 20*.txt
sleep 3
touch `date +F_T`.txt
cp Puppy_5.9.3_Bash_Scripts.zip /mnt/sdb1/Linux_Files
#
cd /root/Icons
zip -u Puppy_5.9.3_Linux_Icons.zip *.png
cp Puppy_5.9.3_Linux_Icons.zip /mnt/sdb1/Linux_Files
#
cd /
cd /usr/share/backgrounds
zip -u Puppy_5.9.3_Linux_Backgrounds.zip
cp Puppy_5.9.3_Linux_Backgrounds.zip /mnt/sdb1/Linux_Files
#
cd /root/Documents
zip -u Puppy_5.9.3_Linux_Documents.zip *.txt *.doc *.rtf *.html *.htm *.png
cd /root/.mozilla/seamonkey/agi9ixk5.default/
cp bookmarks.html /root/Documents
cd /root/Documents
zip -u Puppy_5.9.3_Linux_Documents.zip bookmarks.html
cp Puppy_5.9.3_Linux_Documents.zip /mnt/sdb1/Linux_Files
#
cd /root/.config/Thunar/
zip -u Thunar_Settings.zip uca.xml
cp Thunar_Settings.zip /mnt/sdb1/Linux_Files
#
cd /root/Linux_Manuals_and_Helpful_Items/
zip -u Linux_Manuals.zip *.*
cp Linux_Manuals.zip /mnt/sdb1/Linux_Files
# CREATE FILE THAT SHOWS WHEN BACKUP WAS DONE
cd /mnt/sdb1/Linux_Files
# remove any old 'markers'
# sleep delay needed so new marker file shows at the top of thunar
rm 20*.txt
sleep 3
touch `date +%m-%d-%Y`.txt
gxmessage -timeout 2 BACKUP FROM PUPPY 5.9.3 TO TOSHIBA DRIVE COMPLETE.
#
 
Old 06-04-2015, 08:41 PM   #18
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
This is related, so I did not start a new thread.

When an older script generated 2015-06-04.txt files, it was easy to delete them
with rm 20*.txt.

My newest script generates files with names like 06-04-2015-20:35:21.txt.

I don't see any easy way to delete them.

Can I delete all filenames that start with 2 digits ?
 
Old 06-05-2015, 02:41 AM   #19
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,944

Rep: Reputation: 7324Reputation: 7324Reputation: 7324Reputation: 7324Reputation: 7324Reputation: 7324Reputation: 7324Reputation: 7324Reputation: 7324Reputation: 7324Reputation: 7324
rm 06*.txt
rm *-2015-*.txt
also (delete all filenames that start with 2 digits):
rm [0-9][0-9]*.txt

in more complicated cases you can use find -regex

Last edited by pan64; 06-05-2015 at 07:37 AM. Reason: added info
 
1 members found this post helpful.
Old 06-05-2015, 09:26 AM   #20
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Thanks for the many ways.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
create file with Julian date and current time --- then subtract 5 minutes mfarch99 Linux - General 10 06-18-2014 08:07 AM
Find big file include current date bsdfan Linux - Server 15 05-19-2014 01:34 AM
using stat to determine last file access and comparing to current date in IF statemnt danpaluska Linux - Newbie 2 02-16-2010 11:52 AM
How to generate a .config file based on the current or initial installtion/kernel khaos83 Linux - General 11 01-22-2008 09:53 AM
Appending current date and time to a file frankietomatoes Linux - General 5 11-18-2002 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy

All times are GMT -5. The time now is 10:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration