3 deleted 51 characters in body
source | link

I am currently configuring crontab to delete all files and directories within the path shown every hour.

My current solution is two lines so I was hoping someone could show me how to make this into one line instead. At the moment, the second command removes the complete directory as well. I would like to keep the complete directory and only delete all directories within complete.

What am I doing wrong? Should there be no slash after complete? /*?

I’m a novice when it comes to the command line.

To delete files older than 60 minutes in directory:

0 */1 * * * find /root/Downloads/complete/ -type f -mmin +60 -delete

To delete directories older than 60 minutes within directory:

0 */1 * * * find /root/Downloads/complete/ -type d -mmin +60 -exec rm -r "{}" \;

I am currently configuring crontab to delete all files and directories within the path shown every hour.

My current solution is two lines so I was hoping someone could show me how to make this into one line instead. At the moment, the second command removes the complete directory as well. I would like to keep the complete directory and only delete all directories within complete.

What am I doing wrong? Should there be no slash after complete? /*?

I’m a novice when it comes to the command line.

To delete files older than 60 minutes in directory:

0 */1 * * * find /root/Downloads/complete/ -type f -mmin +60 -delete

To delete directories older than 60 minutes within directory:

0 */1 * * * find /root/Downloads/complete/ -type d -mmin +60 -exec rm -r "{}" \;

I am currently configuring crontab to delete all files and directories within the path shown every hour.

My current solution is two lines so I was hoping someone could show me how to make this into one line instead. At the moment, the second command removes the complete directory as well. I would like to keep the complete directory and only delete all directories within complete.

What am I doing wrong? Should there be no slash after complete? /*?

To delete files older than 60 minutes in directory:

0 */1 * * * find /root/Downloads/complete/ -type f -mmin +60 -delete

To delete directories older than 60 minutes within directory:

0 */1 * * * find /root/Downloads/complete/ -type d -mmin +60 -exec rm -r "{}" \;
2 added 10 characters in body; edited tags; edited title
source | link

What’s the Difference Between Slash (/) and No Slash at Remove old files in a directory but not the End of Directory Path?root

I am currently configuring crontab to delete all files and directories within the path shown every hour.

My current solution is two lines so I was hoping someone could show me how to make this into one line instead. At the moment, the second command removes the completecomplete directory as well. I would like to keep the completecomplete directory and only delete all directories within completecomplete.

What am I doing wrong? Should there be no slash after completecomplete? /*/*?

I’m a novice when it comes to the command line.

To delete files older than 60 minutes in directory:

0 */1 * * * find /root/Downloads/complete/ -type f -mmin +60 -delete

To delete directories older than 60 minutes within directory:

0 */1 * * * find /root/Downloads/complete/ -type d -mmin +60 -exec rm -r "{}" \;

What’s the Difference Between Slash (/) and No Slash at the End of Directory Path?

I am currently configuring crontab to delete all files and directories within the path shown every hour.

My current solution is two lines so I was hoping someone could show me how to make this into one line instead. At the moment, the second command removes the complete directory as well. I would like to keep the complete directory and only delete all directories within complete.

What am I doing wrong? Should there be no slash after complete? /*?

I’m a novice when it comes to the command line.

To delete files older than 60 minutes in directory:

0 */1 * * * find /root/Downloads/complete/ -type f -mmin +60 -delete

To delete directories older than 60 minutes within directory:

0 */1 * * * find /root/Downloads/complete/ -type d -mmin +60 -exec rm -r "{}" \;

Remove old files in a directory but not the root

I am currently configuring crontab to delete all files and directories within the path shown every hour.

My current solution is two lines so I was hoping someone could show me how to make this into one line instead. At the moment, the second command removes the complete directory as well. I would like to keep the complete directory and only delete all directories within complete.

What am I doing wrong? Should there be no slash after complete? /*?

I’m a novice when it comes to the command line.

To delete files older than 60 minutes in directory:

0 */1 * * * find /root/Downloads/complete/ -type f -mmin +60 -delete

To delete directories older than 60 minutes within directory:

0 */1 * * * find /root/Downloads/complete/ -type d -mmin +60 -exec rm -r "{}" \;
1
source | link

What’s the Difference Between Slash (/) and No Slash at the End of Directory Path?

I am currently configuring crontab to delete all files and directories within the path shown every hour.

My current solution is two lines so I was hoping someone could show me how to make this into one line instead. At the moment, the second command removes the complete directory as well. I would like to keep the complete directory and only delete all directories within complete.

What am I doing wrong? Should there be no slash after complete? /*?

I’m a novice when it comes to the command line.

To delete files older than 60 minutes in directory:

0 */1 * * * find /root/Downloads/complete/ -type f -mmin +60 -delete

To delete directories older than 60 minutes within directory:

0 */1 * * * find /root/Downloads/complete/ -type d -mmin +60 -exec rm -r "{}" \;