CobraX83
Posts: 3
Joined: Sun Oct 30, 2016 12:03 pm

Script expert needed - Want to delete pictures in folder

Mon Oct 31, 2016 12:56 am

I am trying to have all the files inside a temp folder deleted if they are an hour or so older....

I was wondering if this is possible on the Pi?

I have many files that get generated after looking at pictures inside Kodi and was looking for a way to have them get deleted as opposed to having to manually delete them. Big thank you to anyone that can assist me or spell it out for me. I have everything else running fine and just need to iron this last thing out.

I am using it to read my comics so it is generating a ton of the pages etc that I look at into the temp folder located in Kodi. If someone can help me to resolve this and make it a viable comic reader for me without having to worry about the space on the sd card from time to time that would be extremely appreciated!

I seemed to successfully re-route my Thumnails folder to the external using a xml I made:

<advancedsettings>
<pathsubstitution>
<substitute>
<from>special://profile/Thumbnails/</from>
<to>/media/usb0/Thumbnails/</to>
</substitute>
</pathsubstitution>
</advancedsettings>

If I can somehow even reroute the temp folder or even all of Kodi to the external that would be insanely awesome for me. Thank you again for any help. I know there are some very intelligent people on these forums so any help to resolve this is appreciated!

FlexibleSigmoid
Posts: 61
Joined: Sun Jul 03, 2016 1:33 am

Re: Script expert needed - Want to delete pictures in folder

Mon Oct 31, 2016 4:15 am

/usr/bin/find <directory> -mindepth 1 -mtime 1 -delete
Google for what values go in the mtime, 1 = 24 hours and decimals work.

CobraX83
Posts: 3
Joined: Sun Oct 30, 2016 12:03 pm

Re: Script expert needed - Want to delete pictures in folder

Mon Oct 31, 2016 4:24 am

FlexibleSigmoid,

First off thank you very much for the response!

I honestly do not know where to start with what you posted. I am assuming I would need to run that as a command / or is it a shell script?

Again, thank you for the help. I am currently all set up on attract mode and was trying to configure Kodi. This is really the last thing I need to get done (setting up what you posted) Thanks again for any help!

*** If I could get that to work properly it would certainly be nice. I was trying to think of a solution and realized I could turn on hidden files, go right over to the file manager built into Kodi, set the folder to the primary one to look at and boom, delete them right there without the need to ftp to the pi and delete etc. Much more convenient so far! ( =

Return to “Troubleshooting”