Script delete tmp folder

Does anyone have a simple script that allows for deletion of a folder.  Scenario would be a temporary folder stored in specific location like C: drive.  I am able to already delete files inside folder with a simple for statement looping and removing.  However I dont seem to be able to figure out how to delete the actual file.
Any example is appreciated.

Thank you for this info.    Indeed I did use the Folder.remove() method thru my own variable.  It turns out I solved it, I had to adjust the path that my variable was pointing too.  Once I did that, it worked correctly.

Similar Messages

  • Script delete sub folder's contents

    I was looking for a script in order to delete all subfolder's content .For example Imagin these path :
    d:\mydoc\folder1 
    d:\mydoc\folder2 
    d:\mydoc\folder3
    d:\mydoc\folder4 
    .d:\mydoc\folderN
    I want to delete all content in the folders 1 to 4 .
    is there any suggestion for that?
    thanx a million

    I was looking for a script in order to delete all subfolder's content .For example Imagin these path :
    d:\mydoc\folder1 
    d:\mydoc\folder2 
    d:\mydoc\folder3
    d:\mydoc\folder4 
    I want to delete all content in the folders 1 to 4 .
    To recursively delete all files under d:\MyDoc, you can use this console command:
    del  /s  /q  d:\MyDoc\*.*
    To recursively delete all files under d:\MyDoc\Folder1 you can use this command:
    del  /s  /q  d:\MyDoc\Folder1\*.*
    To delete only files in subfolders called "folderX" you need to use a loop as recommended by JRV.

  • Need help writing a script to delete a folder to run at startup

    I have no experience with this and need full assistance to set this up.
    I am hoping to write a script which can be run at startup on a single client machine which is giving me font trouble. Our client machines are network controlled by our server and have multiple users all in the Server user database.
    The fonts are behaving badly until we trash this folder HD>Library>Caches>com.apple.ATS
    On restart the fonts behave as expected.
    Can someone help me write a script or give me a command I can insert in a crontab with Cronnix to delete this folder at startup?
    Thanks

    They both work fine (read that as: it can be added into either place) While that message in crontab seems to intimate that Apple will do something drastic like disable or make it hard to run cron I cannot see how, cron has been in all *nix's since the beginning so to remove it would anger quite a few people...
    Having said that, If you want to make a launchd item you would put the below into /Library/LaunchDaemons/ create a file (call it someting memorable like 'Delete_com.apple.ATS') put this into it:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>Delete com.apple.ATS</string>
    <key>ProgramArguments</key>
    <array>
    <string>rm</string>
    <string>-rf</string>
    <string>/Library/Caches/com.apple.ATS</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    </dict>
    </plist>
    and finally load it...
    PowerMac G5 DP 2.5Ghz   Mac OS X (10.4.3)  

  • How to delete the Folder from sql server 2008

    Hi all,
    I was trying to delete the folder from sql server 2008 with the below script
    DECLARE @path VARCHAR(256) -- path for backup files
    DECLARE @cmd VARCHAR(8000)
    DECLARE @folderName VARCHAR(256) -- filename for backup
    SET @folderName = + (CONVERT(varchar(10), GETDATE()-7, 112))  -- 7 days back date folder name
    SET @path = 'I:\Backup_Test\' + @folderName -- Folder path
    SET @cmd = 'del ' + @path -- Delete
    EXEC master..xp_cmdshell @cmd
    --Print @cmd
    This is not working it was asking the Confirmation (I:\Backup_Test\20100629\*, Are you sure (Y/N)? ) what will i do to the delete the folder.
    Thanks,
    Prasad R.

    I would notice   you that T-SQL does not play well to do things like that. Do not you want using .net language to delete folders?
    Old method is
    declare @HR int, @CFOLDER varchar(255),@FSO int
        set @CFOLDER='D:\folder\'
        EXEC @HR = sp_OACreate 'Scripting.FileSystemObject', @FSO OUT
        EXEC @HR = sp_OAMethod @FSO, null, 'DeleteFolder', @CFOLDER 
    Now regarding to your second question please examine xp_fileexist  system stored procedure
    CREATE FUNCTION dbo.fn_file_exists(@filename VARCHAR(300))
      RETURNS INT
    AS
    BEGIN
      DECLARE @file_exists AS INT
      EXEC master..xp_fileexist @filename, @file_exists OUTPUT
      RETURN @file_exists
    END
    GO
    -- test
    SELECT dbo.fn_file_exists('c:\a.txt')
    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/

  • I can't delete a more than 10 bookmarks at a time, I can't delete bookmarks folder

    Firefox 25, Mac 10.8
    If I try to delete more than 10 bookmarks at a time or a folder with bookmarks in it, FF hangs, then says there's a script that isn't running properly & do I want to continue or stop the script - I've tried continuing but it just hangs again, and I've tried stopping the script but it still hangs..
    I've restarted FF, turned off Sync, turned on Sync.
    I tried exporting my bookmarks to html, to edit them in a file then re-import them, but the file was incomplete - it did not contain all the folder in My Bookmarks.
    Deleting bookmarks has been a pain ever since Sync was introduced, and Firefox doesn't have an official iOS app and the 3rd party ones don't work consistently, so I don't get much use from sync

    I'm sorry, I wasn't clear in stating my problem.
    I understand how to delete both bookmarks and folders containing bookmarks according to the instructions, and have done so easily in the past.
    But, since update to FF25 I haven't been able to delete a folder with bookmarks in it or more than 10-12 bookmarks at a time.
    I resolved the issue by quitting FF, importing my bookmarks into Chrome, using Chrome's import as FF also was not exporting a complete bookmark list. I cleared out some duplicates in Chrome, exported bookmarks from Chrome to an html file, removed the places sqlite file from my profile, deleted all FF bookmarks, and imported the bookmarks html file into FF, which created a new & functional places sqlite file with the same set of bookmarks as at the beginning. I can only think the places file was corrupted somehow during the update as that was the only file I had to delete to fix the issue - I can now move & delete folders with hundreds of bookmarks in them and delete as many bookmarks as needed at one time.
    "There is no way to select more than one item at a time in the right pane in the mac environnement. " (sic)
    I think you mean there is no way to delete more than 1 item at a time in the LEFT panel, the list of folders, not in the right panel, the list of bookmarks and the contents (bookmarks) of subfolders.

  • How do I delete a folder without moving focus to parent folder?

    I posted this question in the Apple support forum and have concluded it is specific to Adobe Bridge.
    Is it possible to delete a folder and keep the focus in place instead of moving the focus to the parent folder?
    I sort my photos according to year then date as follows:
    2010
    2011
    2012
         01022012
         01032012
         01152012
         01252012
         02102012
         12202012
         12242012
         12302012
    2013
    The list of subfolders inside each year can be quite long. In order to manage my files/folder, I need to delete SUBFOLDERS (not just files) from the list. The problem is that when a subfolder is deleted, the focus moves to the parent folder, the year, instead of keeping its position and rolling the list of subfolders up.
    Any recommendations will be appreciated. I am hoping there is a short cut key that I can use to avoid the problem

    Any recommendations will be appreciated. I am hoping there is a short cut key that I can use to avoid the problem
    I see what you mean but is seems as designed to always focus on the parent folder when deleting a subfolder while Finder has the option to just point to a folder and with right mouse click menu choose trash without the OS focussing on the selected folder.
    Would be a nice Feature Request I would think.
    Meanwhile you might try your luck in the Bridge Scripting Forum, the folks around there have found the most impossible solutions so maybe they know a solution for you?
    http://forums.adobe.com/community/bridge/bridge_scripting

  • Mail:Cannot erase messages from Deleted Messages folder located on my mac

    Hi,
    I recently ran a script to discover that I have hundreds of thousands of messages sitting in the Deleted Messages folder located on my mac. I tried to erase them but no luck, no error messages of any kind but the messages are still there. Can anyone help with me with this as these unwanted messages are taking up a lot of space. I have run a disk verify just to check permissions etc and all is ok.
    Many thanks

    Hi,
    Many thanks for you reply. Yes it looked like the deleted messages from an old exchange account I had had were sitting in a folder on my mac and this was visible in the sidebar. However it was not simply called deleted messages it was named deleted messages (xxx xxx) where xxx xxxx was the name of the old mailbox. So when I went to mailbox to erase deleted messages this folder was not picked up. So I moved everything in the folder to the trash folder (took a long time) and then selected the option to erase trash on quitting. It took hours and hours when I quit mail but I left it running overnight and now the folder is empty and mail is functioning ok. Thanks again for your help

  • Deleting a Folder Immediately

    Hi
    I'm new to Applescript and have not been able to find an answer after doing a search on the web or in this forum; is there a command that deletes a folder or file immediately rather than just moving it to the trash?

    using the unix command rm is much faster than deleting files with finder commands in applescript. (this is true of shell scripting in general)
    before starting, you should learn more about the command by opening a new window in the Terminal app and typing:
    man rm
    this will tell you all the details about how it works.
    Also, when using unix commands, remember to use "quoted form of posix path of (file alias)". Finder paths (colon separated) will not compute.

  • How to delete the folder in ABAP

    Hi all,
    i am dowmloading one text file into a one particular folder using GUI_download function module. and whenever we are downloading the text files to that particular folder i have to check whether the folder is exist or not, if that folder is existing then i have to delete that folder and i have to put the text file into new folder.
    Note: for Folder creation am using some OOPs concepts , so any body plz send me the code ASAP.
    BALU.

    http://help.sap.com/saphelp_nw04s/helpdata/en/dc/f1783fe3263042e10000000a114084/content.htm
    http://javaalmanac.com/egs/java.io/CopyFile.html?l=rel
    http://javaalmanac.com/egs/java.io/DeleteFile.html
    http://schmidt.devlib.org/java/copy-file.html
    try {
         File inputFile = new File("C:
    test
    fold1
    abc.txt");
         File outputFile = new File("C:
    test
    fold2
    def.txt");
         FileInputStream in = new FileInputStream(inputFile);
         FileOutputStream out = new FileOutputStream(outputFile);
         FileChannel inc = in.getChannel();
         FileChannel outc = out.getChannel();
         inc.transferTo(0, inc.size(), outc);
         inc.close();
         outc.close();
         in.close();
         out.close();
         boolean fileDeleteSuccess = inputFile.delete();
         if(!fileDeleteSuccess)
              System.out.println("File couldnot be deleted");
         else
              System.out.println("File deleted!!");
         } catch (FileNotFoundException e) {
         e.printStackTrace();
         } catch (IOException e) {
         e.printStackTrace();

  • Please Help!! I deleted the folder System en Macintosh HD and now when i on my mac it says Disk Error Press Any  Key To Restart Please HELP !!

    I deleted the folder System en Macintosh HD and now when i on my mac it says Disk Error Press Any  Key To Restart Please HELP !!

    Reinstall Mac OS X.
    (59450)

  • ITunes deletes symlinked folder on Album Artist rename

    Hello community,
    I experience a very strange behavior of iTunes in combination with Symlinked folders. I use Windows 7 and my folder structure is listed below. I have a Laptop with a 256GB SSD and instead DVD-Drive a 640GB SATA drive.
    Drive layout:
    C: System (Windows Drive)
    D: UserProfile (also symlinked to D:\Username
    E: Media
    My iTunes DB is about 170GB large including media of all kind. I spread the iTunes Media subfolders among several drive, because I want iTunes to start up very fast, but playing music and syncing my iPhone would not benefit from the fast SSD Drive so I don't want to waste the valuable fast space.
    Now when I change the Album Artist of an album iTunes kills/deletes my Music symlink folder after completing the first rename and show the rest of the album as missing files (with the ! in front)
    I have discovered that this only happens when iTunes tries to rename/move folders like it does if the Album artist is changed.
    I have already tried restricting the permission to the symlinked folder to read even with deny write permissions, but it manages to delete the folder everytime.
    I have used a folder junction instead also. All without joy.
    The owner of the folder is the Administrators group which my user is a member of. There are several reason I cannot work a a regular user and I do not want to change that.
    So did anyone experience this and knows why this is the case? I would be glad to know. Thanks for everybody investing a thought
    Sorry for this text monster, but this really bugs me.
    Best regards Bruce
    P.S. Maybe Apple will here my whining and look into this behavior also.
    +Directory of C:\Users\Username\Music (actually D:\Username\Music)+
    +2010-09-28 13:12 <DIR> .+
    +2010-09-28 13:12 <DIR> ..+
    +2010-09-27 16:43 <SYMLINKD> iTunes [d:\iTunes]+
    +0 File(s) 0 bytes+
    +3 Dir(s) 146,808,844,288 bytes free+
    +C:\Users\Username\Music>dir itunes+
    +Volume in drive C has no label.+
    +Volume Serial Number is B022-C44F+
    +Directory of C:\Users\Username\Music\itunes+
    +2010-10-02 23:41 <DIR> .+
    +2010-10-02 23:41 <DIR> ..+
    +2010-10-02 23:41 <DIR> Album Artwork+
    +2010-10-02 23:41 1,007,616 iTunes Library Extras.itdb+
    +2010-10-02 18:33 72,208,384 iTunes Library Genius.itdb+
    +2010-10-02 23:32 5,963,887 iTunes Library.itl+
    +2010-10-02 23:30 29,777,149 iTunes Library.xml+
    +2010-10-02 23:29 <DIR> iTunes Media+
    +2010-09-27 16:45 <DIR> Previous iTunes Libraries+
    +4 File(s) 108,957,036 bytes+
    +5 Dir(s) 146,808,844,288 bytes free+
    +C:\Users\Username\Music>dir "itunes\iTunes Media"+
    +Volume in drive C has no label.+
    +Volume Serial Number is B022-C44F+
    +Directory of C:\Users\Username\Music\itunes\iTunes Media+
    +2010-10-02 23:29 <DIR> .+
    +2010-10-02 23:29 <DIR> ..+
    +2010-09-27 16:07 <SYMLINKD> Audiobooks [e:\iTunes\iTunes Media\Audiobook+
    s]
    +2010-09-27 16:03 <DIR> Automatically Add to iTunes+
    +2010-10-02 21:53 <DIR> Downloads+
    +2010-10-02 23:14 <DIR> Mobile Applications+
    +This folder gets deleted.+
    +2010-10-02 23:29 <SYMLINKD> Music [e:\iTunes\iTunes Media\Music]+
    +2010-09-27 16:08 <SYMLINKD> Podcasts [e:\iTunes\iTunes Media\Podcasts]+
    +2010-09-27 16:03 <DIR> Ringtones+
    +2010-09-27 16:09 <SYMLINKD> TV Shows [e:\iTunes\iTunes Media\TV Shows]+

    Hi, welcome to Apple Discussions.
    iTunes and symlinks don't play nicely... They work OK as long as iTunes is only reading data but get all confused when iTunes tries to write back. I recommend you just put the whole library on a drive big enough to hold it all in one go.
    tt2

  • Remove caches file's automatically if you delete a folder from your drive???

    Gday,
    First off all sorry for my poor/bad English.
    When i remove/delete a folder in bridge, where will by the cache file of this folder??
    Does it also Remove/delete automatically, ????
    Or should I in the preferences box, tick on the (automatically Export Cache to folders when possible) option???
    Already many Thanks,
    Henry

    As the others say, no, the backup copy won't be deleted immediately, but it will eventually.
    If you want to delete all backups of a selected item, such as for space or security reasons, see #12 in Time Machine - Frequently Asked Questions.

  • Items are not moved to the deleted items folder when they expire

    Hey
    I have Exchange 2010 Server (Version: 14.01.0438.000) and configured a retention policy with one retention tag for the
    inbox that moves items after 365 days to the deleted items folder. I have assigned this policy to one Mailbox to see if it works. It doesn't. :)
    All Items are "stamped" correctly with a expiry date. And the Messages show now "This item is expired" for example:
    I made the Policy a week ago and waited to see if the items will be moved but nothing happen until today. The Application Log shows no errors or warnings. I already used "Start-ManagedFolderAssistant"
    multiple times....
    what is wrong here? And how do i track the problem down?
    i also checked all the other threads regarding the same or alike issues. But couldn't find anything that would halp me.

    Get-RetentionPolicyTag
    Get-RetentionPolicyTag:
    RunspaceId                      : bab19777-67ac-4a28-a895-19f89113122a
    MessageClassDisplayName         : All Mailbox Content
    MessageClass                    : *
    Description                     : Managed Content Settings
    RetentionEnabled                : True
    RetentionAction                 : MoveToDeletedItems
    AgeLimitForRetention            : 365.00:00:00
    MoveToDestinationFolder         :
    TriggerForRetention             : WhenDelivered
    MessageFormatForJournaling      : UseTnef
    JournalingEnabled               : False
    AddressForJournaling            :
    LabelForJournaling              :
    Type                            : Inbox
    SystemTag                       : False
    LocalizedRetentionPolicyTagName : {}
    Comment                         :
    RetentionId                     : 6c115c72-8186-4828-b801-d434d7fdbcc7
    LocalizedComment                : {}
    MustDisplayCommentEnabled       : False
    LegacyManagedFolder             :
    AdminDisplayName                :
    ExchangeVersion                 : 1.0 (0.0.0.0)
    Name                            : Delete after 1 year (Inbox)
    DistinguishedName               : CN=Delete after 1 year (Inbox),CN=Retention Policy Tag Container,CN=****
                                       AG,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=****,DC=*****
    Identity                        : Delete after 1 year (Inbox)
    Guid                            : 6c115c72-8186-4828-b801-d434d7fdbcc7
    ObjectCategory                  : *****/Configuration/Schema/ms-Exch-ELC-Folder
    ObjectClass                     : {top, msExchELCFolder}
    WhenChanged                     : 07.10.2014 10:16:04
    WhenCreated                     : 07.10.2014 10:16:04
    WhenChangedUTC                  : 07.10.2014 08:16:04
    WhenCreatedUTC                  : 07.10.2014 08:16:04
    OrganizationId                  :
    OriginatingServer               : srv-********
    IsValid                         : True
    Get-RetentionPolicy:
    RunspaceId              : bab19777-67ac-4a28-a895-19f89113122a
    RetentionId             : a83b8845-5f3b-422c-84a1-8eef8a8b2bd2
    RetentionPolicyTagLinks : {Delete after 1 year (Inbox)}
    AdminDisplayName        :
    ExchangeVersion         : 1.0 (0.0.0.0)
    Name                    : Funds@
    DistinguishedName       : CN=Funds@,CN=Retention Policies Container,CN=*****,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=***,DC=****
    Identity                : Funds@
    Guid                    : a83b8845-5f3b-422c-84a1-8eef8a8b2bd2
    ObjectCategory          : hnw.dom/Configuration/Schema/ms-Exch-Mailbox-Recipient-Template
    ObjectClass             : {top, msExchRecipientTemplate, msExchMailboxRecipientTemplate}
    WhenChanged             : 07.10.2014 10:28:26
    WhenCreated             : 07.10.2014 10:28:26
    WhenChangedUTC          : 07.10.2014 08:28:26
    WhenCreatedUTC          : 07.10.2014 08:28:26
    OrganizationId          :
    OriginatingServer       : srv-******
    IsValid                 : True
    I just replaced some "critical information" with *****
    Also the Policy is defently applied. I checked with:
    Get-Mailbox -ResultSize unlimited | Format-Table Name,RetentionPolicy -Auto

  • Unable to delete a folder under Artists and albums...

    Hi..Im not able to delete a folder under Artists and albums in the music player. When deleting im getting msg as "File is Corrupted. Operation Cancelled". Can somebody suggest me how to get rid of the folder??

    Connect phone to computer with usb cable (select mass storage mode) and try to delete folders using computer's file manager.

  • Finder resets itself to default local folder when I delete a folder from a server. How can I stop this?

    Hello there,
    At work I use a Mac Pro (like this one: http://www.everymac.com/systems/apple/mac_pro/specs/mac-pro-quad-core-2.8-2008-s pecs.html)... and I have a very weird problem that is really annoying.
    I don't have the information (but I can get it tomorrow) on the operating system or any information of the server I am having the issues with. But I was hoping maybe some one else with the same issue might have the answer without all of that information.
    We use the server to access, open, edit, save, delete, move, etc... all of the files we are currently working on.  No files are ever transfered to our local computer's hardrive and then copied back to the server (don't ask me why, and don't tell me to do that, this is how it's done in the office, and this is what I have to do)...
    The issue is this.  When I have to delete a folder from the server, which is usually a folder within a folder, and maybe within another folder, and another, and another (meaning it takes me time to look for this), the Finder deltes the folder (and asks if I am sure I  want to delete it, because it will be deleted forever since I am deleting it from the server)... and when I say yes, the Finder window that I am currently on (the folder which contains the folder that I am deleting) reverts back to the initial "device-folder" for my local mac pro... meaning the folder which is the main folder of that mac pro, where I can see the mac pro's hard drive, any external hardrives, any usb pen drives, any cds, etc...
    So EVERY TIME I delete a folder on the server, which is more than 30 times a day, I get "kicked out" of the foler which contains the folder to be deleted, and gows back to tha "main" folder of my computer, so I have to go back to the server, back to the folder, and sometimes it is a folder, within a folder, within a folder, etc, etc, etc, ... and don't tell me the solution is to create a shortcut on my sidebar for that folder, because the folders are the jobs that I may be working on that day, so I could work on as many as 30 different folders per day, and I do have those in my sidebar, but it is still pretty annoying to have to go back to that folder.
    One thing I noticed... SOMETIMES, not all the times... IF I delete two folders instead of one, it won't do it... or IF I drag the folder to the trash, instead of clicking on my "delete" icon on my finder's toolbar, it won't do it... but this is only SOMETIMES. So these are not the solutions either.
    I can try to get a screen cap tomorrow of the issue, but if anyone has this same issue and knows how to fix it, plese let me know.
    I will also try to get more info on my computers OS and the server.
    Thank you,
    MW

    Hi PCM1, if i understand well the problem you have is when you click on a URL in a pdf file, the link opens in IE ? Have you checked in the default programs panel to see if all was well set ?

Maybe you are looking for

  • Need help with Boot Camp dual booting

    I'm trying to install windows 7 on a separate partition but after the mac book pro restarts to start the installation it says windows can't be installed because it needs to be NTFS format but the mac partition is Mac OS Extended(journaled) but gives

  • ALV o/p TO PDF Converison using  CONVERT_ABAPSPOOLJOB_2_PDF

    Hi Geeks, My rquirement is to attach the output of ALV report to the mail as PDF file.I am using FM "CONVERT_ABAPSPOOLJOB_2_PDF" for converting the ALV ouput to PDF format but when i check the data in PDF fomat table , it's corrupted and thus pdf fil

  • Replace Product Poplets lightbox with another jquery lightbox

    Hello, My client would like to disable the default lightbox that comes with the additional product poplet images and use a different jquery lightbox.  I am just wondering how I can disable the poplet lightbox and use another jquery lightbox. I instal

  • Deployed project seems to fail on different machine

    Hi, I deployed my project on my webserver and it worked great on the developing machine.. I accessed the page from any computer using IP/projectname.  I moved the project to a different server and added it to the web server but it seems to fail.. Eve

  • Many problems with my satellite

    I have several problems with my Satellite L505D-LS5001.  There is a red X by the speaker, no audio device installed.  I ran the Realtek driver install program yesterday, my speakers worked, but after shutting down for the day, the red x was back.   I