Я пытался создать сценарий bash, который делает следующее.
Используйте команду find для поиска файлов старше 7 дней (find . -type f -mtime +7 ! -iname '.*' , Выберите родительский каталог (из найденных файлов), создайте новую папку с именем parent directory в другом каталоге и добавьте _todaysDate (date '+%m%d&y) и переместите туда найденные файлы.
что было бы лучше всего сделать это? while? for? do петли? Как бы вы поступили так?
заранее спасибо!
РЕДАКТИРОВАТЬ: Чтобы дать вам пример структуры файла
folder1
- folder2
-oldfile1
folder1a
- folder2a
-folder3a
-oldfile2
----
In a new directory, a new folder would be created ( and that folder's name would be the parent folder of the old file, and tagged with a date (_040114) - this is where i get the format date '+%m%d%y) and the old files would then be moved in there. Example below -
- new_directory
- folder2_date
- oldfile1
- folder3a_date
- oldfile2
Я надеюсь, что это проясняет то, что я пытаюсь сделать.
