file-copying

`shutil.copyfile` Error: Permissions Denied

时间秒杀一切 提交于 2020-01-06 06:10:44
问题 I have worked through a number of other threads on this, but not of their solutions seem to work here, that or I am not understanding properly, and would love your help. I am getting a: IOError: [Errno 13] Permission denied: 'W:\\test\\Temporary Folder 195\\Sub-fold1 This is the general code i started with. summary_file = r'W:/test/SDC Analysis Summary.docm' shutil.copyfile(summary_file, os.getcwd()) I have also varied this a little bit based on other threads, specifically replacing summary

Lazarus & Free Pascal - How to recursively copy a source directory of files to another directory?

我们两清 提交于 2020-01-01 19:26:14
问题 I need to add some functionality to my Lazarus & Free Pascal GUI program - I need it to also copy files from a users chosen dir to another dir. I have a "Choose Source" TSelectDirectoryDialog button onclick event for the source directory and a "Choose Destination" TSelectDirectoryDialog button onclick event for the destination dir. I have a 3rd button to do the copying from Source to Destination. So far, I have found CopyFile that copies the files and the original date attributes, but it

Adding a Progress Bar from a simple copy to the C Drive

喜夏-厌秋 提交于 2019-12-25 01:55:43
问题 I am using this code: My.Computer.FileSystem.CopyFile( "Software\Service Packs\WindowsXP\SP2\WindowsXP-KB835935-SP2-ENU.exe", "C:\Service Pack\WindowsXP-KB835935-SP2-ENU.exe") Process.Start("C:\Service Pack\WindowsXP-KB835935-SP2-ENU.exe") This simply copies Windows XP Service Pack from a pendrive to the C Drive located above. I wish to add a Progress bar to the Form and need the code in order to do this. Thank you, 回答1: Drag a ProgressBar and Timer to the form. Add the following code under

String^ to LPCTSTR in VC++2010 (Windows form application)

烈酒焚心 提交于 2019-12-24 12:30:31
问题 How to convert System::string^ in to LPCTSTR ? As my requirement is to clone a file using function CopyFile , it works fine if i give Fix name (OldFile.jpg and LatestFile.jpg) to its parameters ( below Code: Works Fine ) LPCTSTR in_f,out_f; in_f = _T("d:\\Old.jpg"); out_f = _T("d:\\Latest.jpg"); CopyFile(in_f,out_f,false); above code clone the Old.jpeg in to a Latest.jpg but when i trying to give name (Latest.jpg) which is coming out from some String it won't create file ( below Code: NOT

In Xamarin.Forms, how can I copy a file from the isolated storage to the Downloads folder?

时间秒杀一切 提交于 2019-12-24 06:35:42
问题 I'm trying to copy my database file from the isolated storage to the Download folder (or any folder that the user can access). Currently my database is stored in: /data/user/0/com.companyname.appname/files/Databases/MyDatabase.db I tried to use this code: public string GetCustomFilePath(string folder, string filename) { var docFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var libFolder = Path.Combine(docFolder, folder); if (!Directory.Exists(libFolder))

Dot Sourced Variables VS Global Variables

牧云@^-^@ 提交于 2019-12-24 04:24:10
问题 I have two ways of referencing script variables from a separate script file. Here are two basic examples: 1. Dot Source Variables.ps1 $Source = "source" $Destination = "dest" Execute.ps1 . .\Variables.ps1 Copy-Item -Path $Source -Destination $Destination -Force 2. Global Variable Variables.ps1 $Global:Source = "source" $Global:Destination = "dest" Execute.ps1 .\Variables.ps1 Copy-Item -Path $Source -Destination $Destination -Force I have done research but have yet to find a definitive reason

“Could not find part of the path” error when copying a file

人走茶凉 提交于 2019-12-23 15:44:20
问题 I've googled about this all over the Internet and still haven't found a solution. As an ultimate try, I hope someone can give me an exact answer. I get that error when I try to copy a file from a directory to another in an File Explorer I'm trying to do on my own. It has a treeview control to browse for directories and a listview control to display the contents of the directory. This is how the code would look like, partially: private void copyToolStripMenuItem_Click(object sender, EventArgs

File.Copy in Parallel.ForEach

一世执手 提交于 2019-12-23 08:38:11
问题 I'm trying to create a directory and copy a file (pdf) inside a Parallel.ForEach . Below is a simple example: private static void CreateFolderAndCopyFile(int index) { const string sourcePdfPath = "c:\\testdata\\test.pdf"; const string rootPath = "c:\\testdata"; string folderDirName = string.Format("Data{0}", string.Format("{0:00000000}", index)); string folderDirPath = rootPath + @"\" + folderDirName; Directory.CreateDirectory(folderDirPath); string desPdfPath = folderDirPath + @"\" + "test

How to copy a file to a specific folder in a Python script? [duplicate]

杀马特。学长 韩版系。学妹 提交于 2019-12-23 08:07:54
问题 This question already has answers here : How do I copy a file in Python? (16 answers) Closed 2 years ago . I have the path of a file stored in a variable (say) filePath. I would like to copy that particular file to another specific folder within a Python script. I tried folderPath = (os.getcwd() + "/folder_name/") #to get the path of the folder shutil.copyfile(filePath, folderPath) But I got an error IOError: [Errno 21] Is a directory . How can I solve this ? My question might seem to be a

How to copy one file to many locations simultaneously

拟墨画扇 提交于 2019-12-22 07:27:07
问题 I want to find a way to copy one file to multiple locations simultaneously (with C#). means that i don't want the original file to be read only one time, and to "paste" the file to another locations (on local network). as far as my tests showed me, the File.Copy() will always read the source again. and as far as i understand, even while using memory, that memory piece gets locked. so basically, i want to mimic the "copy-paste" to the form of one "copy", and multiple "paste", without re