If I want to change the timestamp for files and use the timestamp from the directory that contains these files. For this I can use:
Code:
touch -r ./<directory-XYZ> ./<directory-XYZ/*>
Now I need to do this for a few hundred directories...
I'm trying to create a little script but I got stuck very quickly :-) I'm having trouble reading the directories because they contain spaces and special characters ie "[" and "(".
Something very basic like this doesn't work because the "\" in front of each special character is missing.
Code:
ls -d1 */ | while read DIRNAME
do
ls ${DIRNAME}
done
I'm not a frequent script writer and probably because of that I always get stuck between the syntax of bash, csh, ksh etc. I'm always confusing the " ' ` Maybe I'm using the wrong syntax here or should I go with a different approach? I started with find . -type d -mindepth 1 -maxdepth 1 but it gave me the same troubles.