私は次のことを行う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これが私がやろうとしていることを明確にすることを願っています。