Windows 10: How to use batch file to delete specific sub-folders in a folder?

Discus and support How to use batch file to delete specific sub-folders in a folder? in Windows 10 Ask Insider to solve the problem; TL;DR I have a folder, and in it, a new sub-folder is added every day. What commands can I add to a batch file that will keep only the three most... Discussion in 'Windows 10 Ask Insider' started by /u/cag8f, Apr 13, 2020.

  1. /u/cag8f Win User

    How to use batch file to delete specific sub-folders in a folder?


    TL;DR I have a folder, and in it, a new sub-folder is added every day. What commands can I add to a batch file that will keep only the three most recently added sub-folders in this folder?


    Hi all. On my computer I have a folder named folder-data with several files and folders. Every day I will copy this folder, append its filename with the current date, and save it in another folder, folder-bu. So after four days, folder-bu will contain four folders:

    folder-bu/ -->folder-a-200411/ -->folder-a-200412/ -->folder-a-200413/ -->folder-a-200414/

    I want to create a batch file which keeps only the three most recent folders, i.e. deletes any folder inside folder-bu that was added more than three days ago. Is that possible? If so, how exactly would I approach that?

    In a batch file, is it possible to check the date in which a a particular folder was added to folder-bu?

    My end goal is to use Windows Scheduler to execute this batch file every day, to ensure this folder doesn't get too large.

    Thanks in advance.

    submitted by /u/cag8f
    [link] [comments]

    :)
     
    /u/cag8f, Apr 13, 2020
    #1

  2. Trouble deleting a folder

    Thanks for the suggestion but it says "delete folder failed for E:\....." for each folder I try.

    *Confused How to use batch file to delete specific sub-folders in a folder? :confused:

    Will I be forever stuck with these unnecessary folders? *Oh Well How to use batch file to delete specific sub-folders in a folder? :eek:hwell:
     
    oli_ramsay, Apr 13, 2020
    #2
  3. xazraelx Win User
    Software to monitor a folder, backup, then delete?

    Is there such a software that will allow the monitoring of a folder to not only backup, but also delete the data? For example, if I was to have a netbook, and it has the built-in card adapter for my camera, I can just copy all the files over to the netbook in a specific folder (ie, ::Temp Pictures), then the next time it connects to the internet/network it will search the folder for any new files, copy them over to my main PC, then delete the Temp Pictures data?

    I've been looking into doing this, googling and whatnot, and it seems like there are a LOT of options for monitoring folders for updates, new data, copying, etc, but I haven't quite found one that allows you to delete after copying.

    Thanks! *Smile How to use batch file to delete specific sub-folders in a folder? :)
     
    xazraelx, Apr 13, 2020
    #3
  4. WojtasRed Win User

    How to use batch file to delete specific sub-folders in a folder?

    Hidden folders

    I installed `Kane and Lynch` on my PC twice in Program Files(x86) folder but I can`t find them (2 folders with game). But free space on my HDD is lower. So there`re those folders on my hdd. I use option `unhide` hidden folders but still can`t find them. Any suggestions? How can i delete those hidden folders?

    When I run istallation for this game I can see those folders in Program Files(x86) folde.

    I`m using Win 7 Ultimate 64 bit.
     
    WojtasRed, Apr 13, 2020
    #4
Thema:

How to use batch file to delete specific sub-folders in a folder?

Loading...
  1. How to use batch file to delete specific sub-folders in a folder? - Similar Threads - batch file delete

  2. Duplicate Files In Sub-folders

    in Windows 10 Network and Sharing
    Duplicate Files In Sub-folders: Hi Experts, I have a folder with many sub folders, in every sub folder there are many files .jpg , .PDF etc.. I need to duplicate these files in same sub folders on one click. may anybody help me to resolve this problem. I shell be thankful to you experts.Thanks Regard,Faisal...
  3. Duplicate Files In Sub-folders

    in Windows 10 Gaming
    Duplicate Files In Sub-folders: Hi Experts, I have a folder with many sub folders, in every sub folder there are many files .jpg , .PDF etc.. I need to duplicate these files in same sub folders on one click. may anybody help me to resolve this problem. I shell be thankful to you experts.Thanks Regard,Faisal...
  4. Duplicate Files In Sub-folders

    in Windows 10 Software and Apps
    Duplicate Files In Sub-folders: Hi Experts, I have a folder with many sub folders, in every sub folder there are many files .jpg , .PDF etc.. I need to duplicate these files in same sub folders on one click. may anybody help me to resolve this problem. I shell be thankful to you experts.Thanks Regard,Faisal...
  5. how to delete a folder but not the files in a folder?

    in Windows 10 Gaming
    how to delete a folder but not the files in a folder?: I have a folder full of subfolders which themselves are full of subfolders with images, I want to delete the folders themselves but keep the images. I've been trying to use the search:*kind:picture tool to do it but there are so many images that file explorer keeps crashing...
  6. how to delete a folder but not the files in a folder?

    in Windows 10 Software and Apps
    how to delete a folder but not the files in a folder?: I have a folder full of subfolders which themselves are full of subfolders with images, I want to delete the folders themselves but keep the images. I've been trying to use the search:*kind:picture tool to do it but there are so many images that file explorer keeps crashing...
  7. Moving files to a sub-folder

    in Windows 10 Network and Sharing
    Moving files to a sub-folder: When I try to move a file from a folder to a sub-folder, it puts the file in the sub-folder, but remains in the original folder also. I've gone to Windows Explorer > View > Options > View > Folders > and reset the folder options to default but that does nothing. This must...
  8. DriverStore - Folder and sub-folders deleted

    in Windows 10 Installation and Upgrade
    DriverStore - Folder and sub-folders deleted: I'm working on a machine, Dell Vostro 230 running V1803. All attempts to update to a more current version fail with error relating to bad path. I also noticed I cannot update any driver even if I download drivers direct from Dell. So I investigated and the DriverStore...
  9. How to exclude sub folders with specific name from backup

    in Windows 10 Installation and Upgrade
    How to exclude sub folders with specific name from backup: I would like to exclude the node_modules folders from backup. The backup folder has many node_modules subfolders. Are there any methods to exclude subfolders with specific names?...
  10. Shift+Delete corrupt sub-folders

    in Windows 10 Support
    Shift+Delete corrupt sub-folders: Hello, when i delete a folder with x amount of files in it, the files get deleted but the folders stay. when i click on them i get error: location is not available "Path" Access is denied and they cant be deleted. any help is appreciated! 87598