How to delete Folders and Files older than 10 day ?

If I use this below command, I am able to delete only the files and files in sub-folders older than 10 day,
forfiles /p "D:\Testing\Sample" /s /d -10 /c "cmd /c del /s /q @file"
Please help...
Thanks

Hello Raman459,
please see this blog entry:
http://elderec.org/2012/02/scripting-delete-files-and-folders-older-than-x-days/
Your command is ok for files, for folders you need to do another command:
 forfiles -p "D:\Testing\Sample" -d -10 -c "cmd /c IF @isdir == TRUE rd /S /Q @path"
If this post solved your question, please mark as an answer, or if it helped your quest, please vote as helpful. Thank you.
Thank you,
F. Schubert
System Administrator
MCP | Microsoft Certified Professional
MCTS 70-640 | Microsoft Certified Technology Specialist: Windows Server 2008 Active Directory, Configuration
MCTS 70-642 | Microsoft Certified Technology Specialist: Windows Server 2008 Network Infrastructure, Configuration
MCTS 70-643 | Microsoft Certified Technology Specialist: Windows Server 2008 Applications Infrastructure, Configuring
MCTS 70-680 | Microsoft Certified Technology Specialist: Windows 7, Configuration

Similar Messages

  • How to delete daily all idocs older than one year

    Hello
    I wander how to delete daily all idocs older than one year. I guess with an job(but how to create it)

    Hi
    Check this [Link|https://ecohub.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/17c435df-0901-0010-72a7-b9dcd271213d]
    Just give a search in SDN you could find lot of doucments releated to archiving of idocs
    Regards
    Uday

  • Deleted folders and files

     How do I retrieve imported Windows Live Mail storage folders and files deleted during Windows Refresh?

    Hi Torsten,
    I've actually seen that article before and followed some of the instructions but I think SCCM 2012 SP1 introduced the capability for SCCM to automatically delete files so you don't need to run the script (which I couldn't use anyways since I'm not running
    on Windows Server 2012).
    I've reviewed the wsyncmgr.log file and I can see it showing that it is removing some items so I know the automatic clean up is working.
    My issue is that I've got folders and files on my distribution drive that have updates in them that are listed as not downloaded or deployed in SCCM. For example, a while back (late 2012) I download and deployed a lot of the "Critical
    Updates" and put them into an update group and a deployment package.  But I've since deleted both this update group and deployment package from SCCM but the folder used by the deployment package and it's contents are still on the drive. 
    These are the things I'm trying to clean up.
    Is it safe to just delete this folder and it's contents from the drive?
    Thanks
    Nick

  • How to move folders and files using UJFS

    Hi guys,
    I need to move from one environment to another the folders and files in the structure, cause the backup / restore (UJBR) doesn't move that part, now I need to know how to do it in the transaction UJFS . ( I'm using SAP BPC 7.5 NW Patch 8)
    Thanks for your help.
    Cheers,
    Rodrigo

    Thanks for your answer,
    In this case, I'm going to move the files and folders from one server to another, so it's not the scenario you mentioned.
    Cheers,
    Rodrigo

  • How to find folders and files by its partial name c#

    in a specific folder of my hard drive i have stored many other sub folder and files. now i want to list those folders and files name by their partial name.
    for example
    c webapi xx folder
    c mvctutorial xx folder
    done webapi xx folder
    webapi done folder
    webapi.zip file
    mvc.iso file
    now when i like to search by partial name webapi then i want to get list of files and folders name which has webapi word. i want to show their full folder or file name in grid with their full path and size. like below way.
    Name Type location Size
    c webapi xx folder c:\test1 2 KB
    c mvctutorial xx folder c:\test3 3 KB
    done webapi xx folder c:\test1 11 KB
    webapi done folder c:\test1 9 KB
    webapi.zip file c:\test1 20 KB
    mvc.iso file c:\test4 5 KB
    i got a sample code which look like for finding files but the below code may not find folder. so i am looking for a sample code which will find files and folders too. so guide me to solve my issue.
    the below sample code will find files but not sure does it find files by partial name. here is the code. i am not before dev environment. so could not test the below code.
    find files code
    static void Main(string[] args)
    string partialName = "webapi";
    DirectoryInfo hdDirectoryInWhichToSearch = new DirectoryInfo(@"c:\");
    FileInfo[] filesInDir = hdDirectoryInWhichToSearch.GetFiles("*" + partialName + "*.*");
    foreach (FileInfo foundFile in filesInDir)
    string fullName = foundFile.FullName;
    Console.WriteLine(fullName);

    See code below
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    namespace ConsoleApplication1
    class Program
    static void Main(string[] args)
    string partialName = "webapi";
    DirectoryInfo hdDirectoryInWhichToSearch = new DirectoryInfo(@"c:\");
    FileInfo[] filesInDir = hdDirectoryInWhichToSearch.GetFiles("*" + partialName + "*.*");
    foreach (FileInfo foundFile in filesInDir)
    string fullName = foundFile.FullName;
    Console.WriteLine(fullName);
    DirectoryInfo[] foldersInDir = hdDirectoryInWhichToSearch.GetDirectories("*" + partialName + "*.*");
    foreach (DirectoryInfo foundFolder in foldersInDir)
    string fullName = foundFolder.FullName;
    Console.WriteLine(fullName);
    // or
    List<string> filesInDir2 = hdDirectoryInWhichToSearch.GetFiles("*" + partialName + "*.*").Select(x => x.FullName).ToList();
    filesInDir2.AddRange( hdDirectoryInWhichToSearch.GetDirectories("*" + partialName + "*.*").Select(x => x.FullName).ToList());
    foreach (string filesFolders in filesInDir2)
    Console.WriteLine(filesFolders);
    jdweng

  • How to delete Sharepoint Diagnostic log older than 5 months

    Hello , 
    How can I automate Sharepoint log deletion older than 5 months using powershell or C# code ?

    I ran across this code (frankly forgot where) a few years ago, originally to delete IIS logs, but I use if for everything.  It simply goes through each item in a folder and deletes by date.  I save the code below to a ps script, then call it with
    a batch file and schedule a task to run the batch file (reasoning is it is easier to schedule a task to run as a .bat file than .ps1.  Don't forget about changing the execution policy if you decide to use it on non-SharePoint servers as well.
    get-childitem -Path C:\inetpub\logs\LogFiles -recurse |
    where-object {$_.lastwritetime -lt (get-date).addDays(-7)} |
    Foreach-Object { del $_.FullName }

  • Winlogin is deleting folders and files on start-up

    We have been using Crystal Reports Server X1 Release 2 since 2007.  Week ago folders started dissaperaing and found out that there was a conflict with McCaffe update that deleted business objects folder and Tomcat stopped working.  Now we are trying to restore VM from prior file deletion and everytime we boot that up winlogin seems to be applying settings and deleting folders again.  Help!!!

    Not to insult ... this is presented as it is to be sure all facts are given ...
    There are two levels to disk formatting:
    Disk-level
    Partition-level
    Disk-level, which defines how "partitions" are organized.  There are two disk-level formats you need to be aware of for Mac:
    MBR (Master Boot Record), which is used by Windows systems.  This is the one you most likely have on your existing disk.
    GUID is used by Mac.
    Your MBR disk can be left at MBR, in my opinion.  It is likely at least 2 years old, and any backup disks you buy for Mac-backups should be new, in my opinion.
    Within a disk, there are "partitions", with different formats:
    Windows uses a method called NTFS.  It has in the past used FAT, FAT32, but both are replaced by NTFS for most systems now.
    Mac uses HFS+
    Microsoft has a patent on NTFS and only grudgingly allows other computers to even read the disks.  Technically anyone could red it, but Microsoft may at anytime pull the plug and sue any "entity" or operating that tries to read it.
    My suggestion is this:
    Buy new disks for backing up your new Mac system.  Make them self-powered, already formated for Mac.  Buy new snice backups need to be on reliable hardware.
    Also buy new disks for keeping "files only" directories for your new "mac-world".
    Use your old disk to move files off as needed, but it is now a "secondary" disk used to read old files.

  • Deleting folders and files

    I seem to have acquired a Windows Media Player application and folder (I forget now how that happened it was so long ago). When I put the folder into trash and try to delete trash, I get the message "the operation cannot be completed because the item 'wmphelp.htm' is locked." Then a whole series of other items appear to be locked: "windowshade.gif" "whatsnew.htm" etc. So whenever I want to delete the trash, I first have to take Windows Media Player out, empty the trash, then put the application back in the trash (where it has sat for two years now).
    I can highlight both the folder and its program under "Get Info" and neither one appear to be locked. I also appear to have read/write access to the program under "More info..." But clearly, files in the folder or application are locked (which I cannot see or get to in order to unlock). How do I get rid of this Bill Gates-inspired albatross once and for all?
    Thanks!

    Hi raven55,
    If you can launch WMP, do so. Now try to Force Quit by pressing Command + Option + Esc on your keyboard. That will Force Quit the application. Drag the app to the Trash and try to Empty it... see if that helps.
    Carolyn

  • Preparing for Mountain Lion - what folders and files should be saved?

    Hi gang,
    Although some of you make think this is obvious, it really is not. In preparation for Mountain Lion, I curious what folders and files (other than the obvious) should I move off to another drive? I'm going to do a clean install this time around. I'll probably do an upgrade first to understand any gotcha's when I upgrade my wife's MBP later, then do a clean install.
    I'm going to move the documents, my Aperture and iPhoto libraries, but I'm unsure about the iTunes folder and my movies and such. Most of my software has come from the App Store, so I don't need to worry aobut those, and the few other programs I have the software for (iWork, iLife, but we'll probably need new versions of those.
    I just preparing a list to make sure that I get everthing.
    Thanks, Mark

    When doing a clean install OS upgrade I like to swap out the time machine drive, storing/retiring the old time machine as a backup of the old system while keeping it's Time Machine history.
    So personally what I do is:
    #1 clone my boot drive to an external (at this point I have two backups Time Machine + a clone)
    #2 wipe the boot drive and install new OS on it (at this point I still have two copies of my data TM + clone)
    #3 verifiy the old time machine is accessible from the new boot drive (sometimes due to ownership/permissions/filevault this is a problem so check even if migrating from clone)
    #4 selectively migrate files from clone or TM to new install
    #5 Start a new time machine of the new OS drive (sometimes I'll wipe the clone at this point and use it, prefering to keep the old TM as a archived backup)
    One note, I've burned myself at least once forgetting that I'd excluded some parts of my old drive from Time Machine drive (usually Podcasts, Movies), so pay attention to that before relying on it.

  • How to recover lost folders and files - Pls help, help...

    Some days ago I lost all of my 15 GB folders and files that stored in my Macbook Pro hard drive called DATA.  I brought my Macbook pro to an experienced computer tecnicians who providing data recovery services. To his and my suprise, after checking, scanning it a few hours, he said their is no way to recover because he did not find any trails at all.  The computer still seems working properly - I have no problem with any applications.  There are few other folders in the DATA hard disk containing pictures, computer programs still remain.  These lost folders and files contain mainly documents (word, excel, power point, pdf etc) which I accumulated in my many years working  !!!!.  I did not make a back up since last September partly because I think Mac is very safe.
    The computer with me all the time on that day and only my son used Power Point to make a simple presentation on that evening - he can not save it on the folders the he normally use - All the folders and files are gone.
    I will appreciate it very much if any of you can tell me what would be the possible causes and more importanly how to recover the lost folders and files.  They are very very valuable to me.
    Many thanks for your kind attention
    Loimekong from Vietnam
    Macbook Pro 2.4 Ghz
    Intel Core 2 Duo
    4 GB 1067 MhZ DDR3

    First, did the data actually get deleted, or is it still there somewhere?  Try searching the drive for some of the documents, perhaps it's all just in another folder on that drive.
    If it's truly gone, it's impossible for us to say what might have happened to make it unrecoverable.  Perhaps someone using the computer used Secure Empty Trash, or securely erased empty space on the hard drive.  Perhaps it was overwritten by other stuff before you noticed.  It's possible the hard drive is starting to fail, though this seems like an awfully specific problem for that to be the issue.
    Or perhaps the tech you took the computer to didn't know what he was doing.  Why not try recovering what you can on your own?  See Recovering deleted files.
    You should be aware that no computer is safe.  All computers rely on hardware that may fail and software that can have bugs.  You absolutely MUST maintain a good set of frequently-updated backups...  no fewer than two full backups of anything you don't want to lose.
    (Note that my pages contain links to other pages that promote my services, and this should not be taken as an endorsement of my services by Apple.)

  • I accidentally deleted the tab marked "older than 6 months" on the history for firefox how do I fix it?

    I was trying to view the history on FireFox and I accidentally deleted the tab for "older than 6 months" how do I get it back? or will it come back on its own? someone please help.

    Additionally If you have Sync or any other form of backup, you can try to restore the history. You can also try to restore an older '''places.sqlite''' in the Firefox profile directory: '''Help''' ('''Alt''' + '''H''') > '''Troubleshooting Info''' > '''Show Folder'''.

  • Formatted HD, but have backup of all the folders and files of Firefox. How can I restore everything, including plugins, bookmarks and saved settings?

    I have formatted my computer's HD because of a problem with Windows 7, the thing is that Windows 7 didn't start, so I couldn't backup my Firefox settings, bookmarks, plugins, themes, personas and etc. the right way.
    I also don't have a Firefox Sync account.
    What I do have are all the folders and files of Firefox, because I just created a new partition and installed Windows 7 again, what I'm having trouble is finding a way (if there's any) to restore everything from my previous installation to the new one.
    I have searched for days on both Google and on te Firefox forum with no success, the only questions I found are about restoring a profile, but what I'm trying to do is the same thing that the Firefox add-on " FEBE " does, which is restoring everything to the previous configuration.
    Here's alink to the add-on: https://addons.mozilla.org/pt-br/firefox/addon/febe/
    I have tried copying, pasting and overwritting from the " .default " folder to my new installation of Firefox (yes, Firefox was closed), but when I opened it again, nothing was restored.
    I every single folder and file Firefox ever created on my computer, this includes the installation folder (at Program Files), the profile (.default at AppData) folder, the Mozilla folder (ProgramData) and the Mozilla Firefox folder (also at AppData).
    I also had the FEBE add-on installed, but like stated before, unfortunately I couldn't start Windows 7, forcing me to create a new partition to install a new copy of the OS.
    Thanks in advance.
    PS. Sorry if I made the text too long and/or if I mentioned the same things twice, just trying to be thorough.

    Hi Sdarts,
    I apologize for the delay in replying to your question, and I am sorry to hear that you are having issues restoring your Firefox user data.
    Please see the following article, which explains how to restore your Firefox user data using a previously backed up Profiles folder, which seems to apply to your situation:
    * [https://support.mozilla.org/en-US/kb/back-and-restore-information-firefox-profiles Backup and Restore information from Firefox Profiles]
    Please let us know if this solves your problem or if you have any questions.
    Thanks!!
    - Ralph

  • How to print a list of the folders and files in a higher level folder?

    I want to print out a list of the files that I have in a folder. It contains a nested series of folders with files in each. I want to print a list of folders and files in the same order that I see them on the screen. I'm seeing them in the finder in List format.
    If I select all, copy, then paste into a word processor, I get all the files and folder names reorganized alphabetically, which I don't want. Also, I don't get the file size or date modified when I do this.
    I'd prefer not doing 30+ screen shots then having to print them all individually.
    Any suggestions?
    Thanks,
    Brad

    There is also DiskCatalogMaker (http://diskcatalogmaker.com/) even better than PrintWindow in my estimation

  • How to create a folder with standard contained folders and files in SharePoint 2013?

    I've got folders and files on my SharePoint 2013 site that form a template when I add a new folder for a customer. When I create a new folder for a customer, I want those folders and files added automaticly to that new folder. How can I do that?

    How would I go about doing this without Visual Studio? Is that possible? Need to create Folder templates.
    Every "new folder" created should have nested folders already included. 
    Company Name (New Folder 1) 
    Company Documents (1.01)
    Tax Documents (1.02)
    Bank Statements (1.03)
    Extreme novice, please give as much details as possible! I'm trying to implement SP 2013 without all the 2013 software (Visual Studios, SharePoint Designer, etc.)
    Thank you!

  • How do I download all my photos onto an external hard drive intact without loosing iPhoto's features, important info and details? I need to delete pictures and files to make room in My mac's memory which is currently full.

    Hi
    How do I download all my photos onto an external hard drive intact without loosing iPhoto's features, important info and details? I need to delete pictures and files to make room in My mac's memory which is currently full.
    Maro

    So you want to move the iPhoto Library?
    Make sure the drive is formatted Mac OS Extended (Journaled)
    1. Quit iPhoto
    2. Copy the iPhoto Library from your Pictures Folder to the External Disk.
    3. Hold down the option (or alt) key while launching iPhoto. From the resulting menu select 'Choose Library' and navigate to the new location. From that point on this will be the default location of your library.
    4. Test the library and when you're sure all is well, trash the one on your internal HD to free up space.
    Regards
    TD

Maybe you are looking for

  • How do I reduce the file size of a pdf to email?

    I have a 260 MB pdf file generated from Photoshop 6.  I can't seem to reduce the size in Photoshop.  Is there anyway to reduce the pdf outside of Photoshop?  Thanks in advance for any help.

  • Browser Shut-down using "Log off" link

    When a user selects "Log off" in EBP the system displays a page which reads: "End of Session Thank you fro working with the Internet Transaction Server".  Does anyone know how to close this window automatically (requiring no user intervention).  We a

  • Problems with photo in movieclip

    Hello everyone, I'm working on a mobile application with Flash Lite. I want to load some photos into a movieclip. I use a SQL database and one field is called 'photo1_huis'. The URL in that field is http://www.eventeffects.nl/FundaMobile/1/foto1_huis

  • Why apple is banned facetime for Saudi Arabia ...??

    Hi apple, recently my cousin gave me iPhone 4 16 GB ... but unfortunately facetime isn't available and after a research a found out facetime is banned for Saudi Arabia but i live in Bangladesh ... Can't make a video call with out Grameenphone 3G serv

  • I can't hide an image. Help me :

    Hi! I have a problem here If you see the picture, the selected image inside is actually a symbol, and it has animation within. I made this symbol clickable so when I click the symbol i will go into another scene. And this is how it looks like when I