Hi there!
I'm new to FFastrans and have gotten stuck on a problem that probably isn't all too complicated to solve. I would like to delete all directories/subdirectories that are inside my watchfolder once everything is processed. The original files, in my case mp3's, are deleted once they land in my output folder, so all that's left in my watchfolder are empty directories. I have a working command processor for deleting the directories but have yet to figure out how to correctly trigger it. My first thought was using a conditional processor to do something in the likes of:
if exists("watchfolder/*") == 0 " then trigger delete directories else run workflow. Thanks in Advance.---
Delete watchfolder directories/subdirectories after Processing all Files
Re: Delete watchfolder directories/subdirectories after Processing all Files
HI Borky, thank you for using FFAStrans and welcome to the forum!
You can try and add a command executor node at the end of your workflow with this command:
%comspec% /C "robocopy "%s_original_path%" "%s_original_path%" /S /move"
This is a nice little trick to remove all empty folders and subfolders from the %s_original_path%, being the watch folder.
Hope this helps.
-steinar
You can try and add a command executor node at the end of your workflow with this command:
%comspec% /C "robocopy "%s_original_path%" "%s_original_path%" /S /move"
This is a nice little trick to remove all empty folders and subfolders from the %s_original_path%, being the watch folder.
Hope this helps.
-steinar
Re: Delete watchfolder directories/subdirectories after Processing all Files
Hi Steinar,
thanks for the fast reply and the solution. The command does work to some extent but will only delete the directories containing the processed files. A quick example, if I have a directory hierarchy "artist -> album", only the album directories will be deleted since they contain the to be processed tracks.
Thanks in advance
thanks for the fast reply and the solution. The command does work to some extent but will only delete the directories containing the processed files. A quick example, if I have a directory hierarchy "artist -> album", only the album directories will be deleted since they contain the to be processed tracks.
Thanks in advance
Re: Delete watchfolder directories/subdirectories after Processing all Files
Hey Borky,
As I understand the Robocopy-Command it only deletes EMPTY folders by MOVING the original Path OVER the destination path (which are the same). So a soulution could be to execute the command twice - so use two nodes to delete both folders...
p.s.: be aware, that also other empty folders will be deleted.
Another workaround could be to check for remaining files in the folder by a conditional-node (Function EXIST "original Path/*.WAV" = 0).
-> TRUE: then RD/SQ [Add the correct path, using OriginalDrive/OriginalPath~n...)/ArtistFolder (Remove Directory) in a new node. TRY THIS IN A SAVE ENVIRONMENT pleas, as I am not in my studio to test this on my own...
cheers,
tom
As I understand the Robocopy-Command it only deletes EMPTY folders by MOVING the original Path OVER the destination path (which are the same). So a soulution could be to execute the command twice - so use two nodes to delete both folders...
p.s.: be aware, that also other empty folders will be deleted.
Another workaround could be to check for remaining files in the folder by a conditional-node (Function EXIST "original Path/*.WAV" = 0).
-> TRUE: then RD/SQ [Add the correct path, using OriginalDrive/OriginalPath~n...)/ArtistFolder (Remove Directory) in a new node. TRY THIS IN A SAVE ENVIRONMENT pleas, as I am not in my studio to test this on my own...
cheers,
tom
Re: Delete watchfolder directories/subdirectories after Processing all Files
Hey Borky,
Sorry for confusing - but... I tested a bit. Especially when you use multiple Job Slots (Options -> Configuration -> Host) the workflow may run into trouble as it processes the original folder multiple times. I send a Workflow along which worked for me. It has a double RD-Command-Executor with a Delay-Node and the delayed RD-Node has no exit-code function.
Please test in a sandbox...
regards
tom
Sorry for confusing - but... I tested a bit. Especially when you use multiple Job Slots (Options -> Configuration -> Host) the workflow may run into trouble as it processes the original folder multiple times. I send a Workflow along which worked for me. It has a double RD-Command-Executor with a Delay-Node and the delayed RD-Node has no exit-code function.
Please test in a sandbox...
regards
tom
- Attachments
-
- Tom_ProcessFLACdelAlbumFolder.json
- (8.95 KiB) Downloaded 204 times
Re: Delete watchfolder directories/subdirectories after Processing all Files
Hey Thomas,
thank you for the suggestions and the workflow, will try it out today. We've got a somewhat working workflow so far but are still tweaking around with the conditional node, which seems to run into problems with hidden files such as ".db's".
Thanks,
Borky
thank you for the suggestions and the workflow, will try it out today. We've got a somewhat working workflow so far but are still tweaking around with the conditional node, which seems to run into problems with hidden files such as ".db's".
Thanks,
Borky
Re: Delete watchfolder directories/subdirectories after Processing all Files
Hey Borky,
in the Conditional-Node try to find only your Audio-Files like
or
in the following Executor-Node the command
will delete the Folder regardless, what is left in it.
hope this helps.
regards
tom
in the Conditional-Node try to find only your Audio-Files like
Code: Select all
$exists("%s_original_path%\*.FLAC")
Code: Select all
$exists("%s_original_path%\*.wav")
Code: Select all
%comspec% /C "RD /S /Q"D:\TEST\%s_recursed_path%""
hope this helps.
regards
tom