I have many big folders with thousands of files in them and I want to use touch
to set their modification times to be "original time"+3 hours.
I got this script from a similar thread in superuser:
#!/bin/sh
for i in all/*; do
touch -r "$i" -d '+3 hour' "$i"
done
so I'm guessing what I need is to make it work in any directory instead of a fixed one (so I won't need to edit the script everytime I want to run it somewhere different) and for it to able to find and edit files recursively.
I have little experience using Linux and this is my first time setting up a bash script, though I do know a thing or two about programming (mainly in C).
thanks you all very much for the help 🙂
Best Answer
Use
find -exec
for recursivetouch
, with command line args for dirs to process.You can run it like this: