Using GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
I am a bash scripting novice, not sure where to begin except at shebang #!
.
The following command.
touch -a -m -t 201501010000.00 somefile.txt
, will modify "somefile.txt" access time and modification time.Is there a way to have a bash script?
Operating within the directory "/mnt/harddrive/BASE/"
Prompt user input for. "somefilename.txt", or "somedirectoryname".
- Prompt user input for. "datetime sequence". Instead of using the current time-stamp, explicitly specify the time/date using
-t
and-d
options. - Recursively change/modify. "atime", "mtime" on "sub-directory’s" within the BASE directory and "files" within that "sub-directory". AND
- Change/modify. "atime", "mtime" of "somefilename.txt" located in the "/mnt/hardrive/BASE/" directory.
Optional 6. Append "mtime" to "somefilename" and "somedirectoryname" before the file extension. ie: "somefilename-01-01-2015.txt" or "somedirectoryname-01-01-2015". Prompt user: do you want to append "mtime" to "somefilename.txt" "YES/NO" if "YES/NO" continue.
stat
the directory and file output to the console or "/tmp" directory text file and display withcat
then delete the "sometmpfile"rm -r
.
bash
scripting primer to get the basics under your belt. – datUser Jan 21 at 20:48