Skip to main content
added 3 characters in body
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264

touch -- change file access and modification times

touch(1)

Note: while you could do touch * this wontwon't recurse into subdirectories and will create a file named * if no files exist. A more robust solution would be to use:

find /path/to/root_dir/ -exec touch -a {} \;

Additionally it seems like you only want to update the modify time of the directories? This is probably better since I'm sure the deletion policy on that server is to save space and you don't want to be keeping all files blindly just to save a few. To only touch directories you can do:

find /path/to/root_dir/ -type d -exec touch -a {} \;

note: touch with no options will modify both the access and modified times to the current time, where -a will only update the access time.

Additionally, if you want to have a command that will just show you which files are close to deletion, you can run something like;

find /path/to/root_dir/ -atime +55

That will list all files in /path/to/root_dir/ which have an access time older than 55 days. This could be useful in letting you know which files are coming up on their max age. You can change 55 to another number if you want to check even further back.

touch -- change file access and modification times

touch(1)

Note: while you could do touch * this wont recurse into subdirectories and will create a file named * if no files exist. A more robust solution would be to use:

find /path/to/root_dir/ -exec touch -a {} \;

Additionally it seems like you only want to update the modify time of the directories? This is probably better since I'm sure the deletion policy on that server is to save space and you don't want to be keeping all files blindly just to save a few. To only touch directories you can do:

find /path/to/root_dir/ -type d -exec touch -a {} \;

note: touch with no options will modify both the access and modified times to the current time, where -a will only update the access time.

Additionally if you want to have a command that will just show you which files are close to deletion you can run something like;

find /path/to/root_dir/ -atime +55

That will list all files in /path/to/root_dir/ which have an access time older than 55 days. This could be useful in letting you know which files are coming up on their max age. You can change 55 to another number if you want to check even further back.

touch -- change file access and modification times

touch(1)

Note: while you could do touch * this won't recurse into subdirectories and will create a file named * if no files exist. A more robust solution would be to use:

find /path/to/root_dir/ -exec touch -a {} \;

Additionally it seems like you only want to update the modify time of the directories? This is probably better since I'm sure the deletion policy on that server is to save space and you don't want to be keeping all files blindly just to save a few. To only touch directories you can do:

find /path/to/root_dir/ -type d -exec touch -a {} \;

note: touch with no options will modify both the access and modified times to the current time, where -a will only update the access time.

Additionally, if you want to have a command that will just show you which files are close to deletion, you can run something like;

find /path/to/root_dir/ -atime +55

That will list all files in /path/to/root_dir/ which have an access time older than 55 days. This could be useful in letting you know which files are coming up on their max age. You can change 55 to another number if you want to check even further back.

added 589 characters in body
Source Link
jesse_b
  • 41.6k
  • 14
  • 108
  • 162

touch -- change file access and modification times

touch(1)

Note: while you could do touch * this wont recurse into subdirectories and will create a file named * if no files exist. A more robust solution would be to use:

find /path/to/root_dir/ -exec touch -a {} \;

Additionally it seems like you only want to update the modify time of the directories? This is probably better since I'm sure the deletion policy on that server is to save space and you don't want to be keeping all files blindly just to save a few. To only touch directories you can do:

find /path/to/root_dir/ -type d -exec touch -a {} \;

note: touch with no options will modify both the access and modified times to the current time, where -a will only update the access time.

Additionally if you want to have a command that will just show you which files are close to deletion you can run something like;

find /path/to/root_dir/ -atime +55

That will list all files in /path/to/root_dir/ which have an access time older than 55 days. This could be useful in letting you know which files are coming up on their max age. You can change 55 to another number if you want to check even further back.

touch -- change file access and modification times

touch(1)

Note: while you could do touch * this wont recurse into subdirectories and will create a file named * if no files exist. A more robust solution would be to use:

find /path/to/root_dir/ -exec touch {} \;

Additionally it seems like you only want to update the modify time of the directories? This is probably better since I'm sure the deletion policy on that server is to save space and you don't want to be keeping all files blindly just to save a few. To only touch directories you can do:

find /path/to/root_dir/ -type d -exec touch {} \;

touch -- change file access and modification times

touch(1)

Note: while you could do touch * this wont recurse into subdirectories and will create a file named * if no files exist. A more robust solution would be to use:

find /path/to/root_dir/ -exec touch -a {} \;

Additionally it seems like you only want to update the modify time of the directories? This is probably better since I'm sure the deletion policy on that server is to save space and you don't want to be keeping all files blindly just to save a few. To only touch directories you can do:

find /path/to/root_dir/ -type d -exec touch -a {} \;

note: touch with no options will modify both the access and modified times to the current time, where -a will only update the access time.

Additionally if you want to have a command that will just show you which files are close to deletion you can run something like;

find /path/to/root_dir/ -atime +55

That will list all files in /path/to/root_dir/ which have an access time older than 55 days. This could be useful in letting you know which files are coming up on their max age. You can change 55 to another number if you want to check even further back.

added 569 characters in body
Source Link
jesse_b
  • 41.6k
  • 14
  • 108
  • 162

touch -- change file access and modification times

touch -- change file access and modification times

touch(1)

Note: while you could do touch * this wont recurse into subdirectories and will create a file named * if no files exist. A more robust solution would be to use:

find /path/to/root_dir/ -exec touch {} \;

Additionally it seems like you only want to update the modify time of the directories? This is probably better since I'm sure the deletion policy on that server is to save space and you don't want to be keeping all files blindly just to save a few. To only touch directories you can do:

find /path/to/root_dir/ -type d -exec touch {} \;

touch -- change file access and modification times

touch(1)

touch -- change file access and modification times

touch(1)

Note: while you could do touch * this wont recurse into subdirectories and will create a file named * if no files exist. A more robust solution would be to use:

find /path/to/root_dir/ -exec touch {} \;

Additionally it seems like you only want to update the modify time of the directories? This is probably better since I'm sure the deletion policy on that server is to save space and you don't want to be keeping all files blindly just to save a few. To only touch directories you can do:

find /path/to/root_dir/ -type d -exec touch {} \;
Source Link
jesse_b
  • 41.6k
  • 14
  • 108
  • 162
Loading