上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。

Delete any file in the current directory (and all of the subdirectories in the current directory) if there is a corresponding file which is not older than the file under a certain directory

This script: delete_old2.txt tries to delete any file in the current directory (and in all of the subdirectories in the current directory) if there is a corresponding file which is not older than the file under a certain directory which is input.

This script first tries to find all the files in the current directory (and in all the subdirectories in it).

The directory containing each found file, which is called "file A" in this document, is called "directory B" in this document.

The input directory, which should be compared, is called "directory C" in this document.

If there is a corresponding file, which is called "file D", in a corresponding directory, which is called "directory E" in this document, in the directory C, and if the file A is not newer than the file D, the file A is deleted.

If there is the file D in the directory E in the directory C, and if the file A is newer than the file D, it is reported.

If there is not the directory E in the directory C, it is reported.

If there is a file whose name is same as the directory E, it is reported.

If there is not the file D, it is reported.

It is confirmed that this script works as described in the above on debian jessie at 2016/8/27.
But, if the path of the files contains special character(s) such as a space, this script may delete important files and directories. DO NOT use this script if there is such paths in the current directory and/or in the input directory.

Old versions:
delete_old.txt has a bug. It removes any file, if the file D in the directory E in the directory C is the symbolic link to the file A.

This post is updated at 2016-08-27.
プロフィール

kiyoshi

Author:kiyoshi
FC2ブログへようこそ!

最新記事
最新コメント
最新トラックバック
月別アーカイブ
カテゴリ
検索フォーム
RSSリンクの表示
リンク
ブロとも申請フォーム

この人とブロともになる

QRコード
QRコード
since 2011/9/25
現在の閲覧者数:
上記広告は1ヶ月以上更新のないブログに表示されています。新しい記事を書くことで広告を消せます。