For Example:
I have folder z.
it contains 3 subfolders a,b, and c
each subfolder contains many files.
I want to delete any subfolder, not containing text files.
(let's say "a" contains text files. so "a" will stay but "b" and "c" don't so they will be deleted.)
Solved! Go to Solution.
First, use the action "Get subfolders in folder" where you specify your base folder.
Then use any loop, for example a "for each"-loop and iterate through all the subfolders
Inside that loop, you can use "Get files in folder" and use the file filter by *.txt.
The you can use an IF-condition and check if the files from the "Get files in folder" action count is = 0,
and then finally delete that folder
Hi.
Try this in your IF condition:
IF Files.Count = 0 THEN
Folder.Delete Folder: Subfolder
END
First, use the action "Get subfolders in folder" where you specify your base folder.
Then use any loop, for example a "for each"-loop and iterate through all the subfolders
Inside that loop, you can use "Get files in folder" and use the file filter by *.txt.
The you can use an IF-condition and check if the files from the "Get files in folder" action count is = 0,
and then finally delete that folder
Hi, Thanks for the reply.
I did as you said. but still, it's not working. can please point me out what doing wrong? I'm totally new at PAD.
here is the Flow and screenshot too:
Folder.GetSubfolders Folder: FolderPath FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Subfolders
LOOP FOREACH Subfolder IN Subfolders
Folder.GetFiles Folder: Subfolder FileFilter: $'''*.txt''' IncludeSubfolders: True FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
IF Files = 0 THEN
Folder.Delete Folder: Subfolder
END
END
Hi.
Try this in your IF condition:
IF Files.Count = 0 THEN
Folder.Delete Folder: Subfolder
END
It finally works!! thank you much.
Thank you so much. much appreciated.
User | Count |
---|---|
13 | |
7 | |
6 | |
6 | |
5 |
User | Count |
---|---|
20 | |
17 | |
17 | |
12 | |
11 |