delete-file

PowerShell script to delete files from list and output list of deleted file

血红的双手。 提交于 2020-01-12 10:06:05
问题 I have a list of files including their location in a .txt like the following: \SERVER01\backupsFolder\xx\a\ss.bak \SERVER01\backupsFolder\xx\a\ss.bak \SERVER02\backupsFolder\yy\b\dd.bak \SERVER02\backupsFolder\yy\b\dd.bak How do I delete everything else recursively starting from the 'backupsFolder' folder for example, and also output all the deleted files? 回答1: I think this should help. Script: $TargetFolder = “Pathofyourfolder” $Files = Get-ChildItem $TargetFolder -Exclude (gc List.txt)

PowerShell script to delete files from list and output list of deleted file

大兔子大兔子 提交于 2020-01-12 10:04:47
问题 I have a list of files including their location in a .txt like the following: \SERVER01\backupsFolder\xx\a\ss.bak \SERVER01\backupsFolder\xx\a\ss.bak \SERVER02\backupsFolder\yy\b\dd.bak \SERVER02\backupsFolder\yy\b\dd.bak How do I delete everything else recursively starting from the 'backupsFolder' folder for example, and also output all the deleted files? 回答1: I think this should help. Script: $TargetFolder = “Pathofyourfolder” $Files = Get-ChildItem $TargetFolder -Exclude (gc List.txt)

PHP recursive delete function

半世苍凉 提交于 2020-01-11 09:01:30
问题 I wrote recursive PHP function for folder deletion. I wonder, how do I modify this function to delete all files and folders in webhosting, excluding given array of files and folder names (for ex. cgi-bin, .htaccess)? BTW to use this function to totally remove a directory calling like this recursive_remove_directory('path/to/directory/to/delete'); to use this function to empty a directory calling like this: recursive_remove_directory('path/to/full_directory',TRUE); Now the function is function

How to delete file and that file is used by another process using C#

和自甴很熟 提交于 2020-01-07 07:08:08
问题 In my C# application I want to delete file in below scenario. OpenFileDialog and select any .jpg file. Display that file in PictureBox. Delete that file if needed. I already try while doing step 3 I set default Image to PictureBox just before delete but that is not work. How can I delete file? Please suggest me. // Code for select file. private void btnSelet_Click(object sender, EventArgs e) { if (DialogResult.OK == openFileDialog1.ShowDialog()) { txtFileName.Text = openFileDialog1.FileName;

Batch file to split text file into multiple files in same directory on Win Svr 2012 using NO 3rd Party Apps [closed]

安稳与你 提交于 2020-01-07 02:51:27
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I am hoping the wonderful experts here can assist me with my problem. I have found this site extremely useful in the past in solving other issues I have had but I have searched this site and tried all the answers similar to my problem but cant seem to get any of them to work for

Mule - Delete files with Files Connector

假如想象 提交于 2020-01-07 01:49:29
问题 This is my main mule flow : HTTP > Payload > File (Create) > Property (File Name) JMS And that JMS calls to other flow that starts with JMS JMS > JSON TO XML > File (Delete by file name) Firstly, I create a file with the JSON message. And finally, when JSON message is transformed to XML , I try to delete the file by name calling a property that tell me the name. But the files doesn't delete. Its output this action by log: Writing file to: C:\errors\91fa03a0-dd33-11e5-a0d9-408d5c4c1bf3.dat How

Cannot delete files from a directory

家住魔仙堡 提交于 2020-01-06 04:21:45
问题 I am describing my work process bellow: I get image files from a directory. Creating a PictureBox array for displaying the images. Creating a Image array from the files that I got from the directory. I am creating this array for making the image source of PictureBox . I am copying the files to another directory. By this: File.Copy(allFiles[i],fullPath+fullName+"-AA"+nameString+ext); Now I want to delete the files from the directory. For this I am doing this: File.Delete(allFiles[i]); But its

File deletion/moving failing

送分小仙女□ 提交于 2020-01-05 09:10:39
问题 In the code below I am trying to select xml files from an ArrayList xmls where xmls.get(i) is the absolute path of a file with extension .xml. If this file cannot be parsed by Document an exception is thrown and the file is moved to a different directory. However, I cannot move or delete the file although I can copy it to the directory destFile. The values of the last if statement return true for f.exists() , f.canRead() , f.canWrite( ), f.canExecute but returns false for f.renameTo(destFile)

Delete all files and folders in multiple directory but leave the directoy

无人久伴 提交于 2020-01-04 05:57:14
问题 Well I like this nice piece of code right here it seems to work awesomely but I can't seem to add any more directories to it DirectoryInfo dir = new DirectoryInfo(@"C:\temp"); foreach(FileInfo files in dir.GetFiles()) { files.Delete(); } foreach (DirectoryInfo dirs in dir.GetDirectories()) { dirs.Delete(true); } I would also like to add in special folders as well like History and cookies and such how would I go about doing that (I would like to include at least 4-5 different folders) 回答1:

Delete part of a file in C

心已入冬 提交于 2020-01-04 05:48:21
问题 How can I create a function to delete certain part of a file? For example, the file is: -. Chair: A23 Number: 123 Name: Joshua -. Chair: B12 Number: 512 Name: Marcus -. Chair: C2 Number: 1 Name: Drake If the input is B12 Then the file shall become -. Chair: A23 Number: 123 Name: Joshua -. Chair: C2 Number: 1 Name: Drake I need this function for my program to work, but I have no idea how can I do that. 回答1: Open a new file in the same directory as the original file. Write to that file what you