Command to Delete All Transcoded Files in Subfolders

Don't miss a thing. Post your questions and discussion about other uncategorized NAS features here.
Post Reply
JCNAP
Starting out
Posts: 25
Joined: Tue Aug 24, 2021 4:42 am
Location: UK

Command to Delete All Transcoded Files in Subfolders

Post by JCNAP » Tue Aug 02, 2022 4:16 am

Hi there,

Anyone know of a command or app to delete all transcoded video files/folders within subfolders?

I want to free up some space.

I have many folders with transcoded films on them. Wanted to avoid going one by one.

Much appreciated.

Thank you.

Edited 7/Aug/2022

The App I am referring to is File Station on QTS.
The transcoding App is Video Station on QTS.
And the App in charge of programming and scheduling the the Transcode process is Multimedia Console on QTS.

Video station automatically transcodes all the videos I upload into a subfolder called @Transcode.

There are more than 100 of these folders.... hoping I can nip it in the bud with a command line or... another App.

Thanks.
Last edited by JCNAP on Sun Aug 07, 2022 6:36 pm, edited 1 time in total.

User avatar
dolbyman
Guru
Posts: 28624
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: Command to Delete All Transcoded Files in Subfolders

Post by dolbyman » Tue Aug 02, 2022 4:39 am

As you posted this in Misc...what are we talking about? QNAP app? Plex?,[...]

dosborne
Been there, done that
Posts: 966
Joined: Tue May 29, 2018 3:02 am

Re: Command to Delete All Transcoded Files in Subfolders

Post by dosborne » Tue Aug 02, 2022 11:28 am

This is from a different system / platform, bit you could do something similar to find and delete file that match a specific pattern . Best to do a test run to ensure it doesn't delete something unexpectedly though.

Code: Select all

/bin/find /mnt/HDA2/docs -iname PP11Thumbs.ptn* -type f -delete
QNAP TS-563-16G 5x10TB Seagate Ironwolf HDD Raid-5 NIC: 2x1GB 1x10GbE
QNAP TS-231P-US 2x18TB Seagate Exos HDD Raid-1
[Deadbolt - Updated Information on Detection, Prevention, Recovery & MORE]
[Deadbolt - How to Reset your NAS]
[Deadbolt - Read your OP_RETURN key YOURSELF]

JCNAP
Starting out
Posts: 25
Joined: Tue Aug 24, 2021 4:42 am
Location: UK

Re: Command to Delete All Transcoded Files in Subfolders

Post by JCNAP » Sun Aug 07, 2022 6:32 pm

dosborne wrote:
Tue Aug 02, 2022 11:28 am
This is from a different system / platform, bit you could do something similar to find and delete file that match a specific pattern . Best to do a test run to ensure it doesn't delete something unexpectedly though.

Code: Select all

/bin/find /mnt/HDA2/docs -iname PP11Thumbs.ptn* -type f -delete
Looks good, but the transcode folders appear like '/@transcode' - with an 'at' symbol ahead.

The command picked it up unfortunately.

JCNAP
Starting out
Posts: 25
Joined: Tue Aug 24, 2021 4:42 am
Location: UK

Re: Command to Delete All Transcoded Files in Subfolders

Post by JCNAP » Sun Aug 07, 2022 6:37 pm

dolbyman wrote:
Tue Aug 02, 2022 4:39 am
As you posted this in Misc...what are we talking about? QNAP app? Plex?,[...]
Hey DolbyMan,

I've updated the deets:

Edited 7/Aug/2022

The App I am referring to is File Station on QTS.
The transcoding App is Video Station on QTS.
And the App in charge of programming and scheduling the the Transcode process is Multimedia Console on QTS.

Video station automatically transcodes all the videos I upload into a subfolder called @Transcode.

There are more than 100 of these folders.... hoping I can nip it in the bud with a command line or... another App.

Thanks.

forumhund
First post
Posts: 1
Joined: Mon Apr 26, 2021 7:27 pm

Re: Command to Delete All Transcoded Files in Subfolders

Post by forumhund » Thu Sep 22, 2022 8:05 pm

Probably too late for OP, but this is what I managed to put together for this purpose (from https://stackoverflow.com/questions/130 ... rtain-name):

Code: Select all

find . -type d -name '@Transcode' -prune -exec rm -rf {} \;

EDIT

Depending on your permissions you might need to use sudo. Of course, be careful with such bulk operations, particularly involving sudo.

Also, you could remove the hidden thumbnail folders that way as well. Just replace '.@__thumb' for '@Transcode'. Again, make sure you don't delete any important data. And you would have to follow this advice to not have them regenerated: https://www.qnap.com/en/how-to/faq/arti ... le-station.

dosborne
Been there, done that
Posts: 966
Joined: Tue May 29, 2018 3:02 am

Re: Command to Delete All Transcoded Files in Subfolders

Post by dosborne » Thu Sep 22, 2022 11:59 pm

forumhund wrote:
Thu Sep 22, 2022 8:05 pm
Also, you could remove the hidden thumbnail folders that way as well. Just replace '.@__thumb' for '@Transcode'. Again, make sure you don't delete any important data. And you would have to follow this advice to not have them regenerated: https://www.qnap.com/en/how-to/faq/arti ... le-station.
I have a number of "find/deletes" in my cron table to perform cleanup on a nightly basis. The are many options to the "find" including deleting by age too which is quite handy to keep only the last 30 days of temp / log files for example.

As you mentioned, it is VERY important to test the command before running it live. Replace the "rm" with "ls" for instance to see what would be done before actually deleting.
QNAP TS-563-16G 5x10TB Seagate Ironwolf HDD Raid-5 NIC: 2x1GB 1x10GbE
QNAP TS-231P-US 2x18TB Seagate Exos HDD Raid-1
[Deadbolt - Updated Information on Detection, Prevention, Recovery & MORE]
[Deadbolt - How to Reset your NAS]
[Deadbolt - Read your OP_RETURN key YOURSELF]

User avatar
OneCD
Guru
Posts: 10504
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Command to Delete All Transcoded Files in Subfolders

Post by OneCD » Fri Sep 23, 2022 4:40 am

Also note: some versions of QTS (mostly older) use a custom BusyBox with a rather limited 'find' implementation. It doesn't support the "-exec" parameter. :(

For those QTS versions, you'll need to install GNU 'find' through Entware.

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage

dosborne
Been there, done that
Posts: 966
Joined: Tue May 29, 2018 3:02 am

Re: Command to Delete All Transcoded Files in Subfolders

Post by dosborne » Fri Sep 23, 2022 1:18 pm

I run mine from a raspberry pi on the shares from 4xNAS boxes to clean out temp files :)
QNAP TS-563-16G 5x10TB Seagate Ironwolf HDD Raid-5 NIC: 2x1GB 1x10GbE
QNAP TS-231P-US 2x18TB Seagate Exos HDD Raid-1
[Deadbolt - Updated Information on Detection, Prevention, Recovery & MORE]
[Deadbolt - How to Reset your NAS]
[Deadbolt - Read your OP_RETURN key YOURSELF]

Post Reply

Return to “Miscellaneous”