PatrickArtner I think you have mistakenly marked this as duplicate. Please read the question carefully. I just can't get the copy to work with the timestamp variable in the dest file name ". So referring posts on how to rename a file or how to copy a file in python does not do the justice to OP. Kindly, remove the duplicate marker.
Probably closest to this users problem after fixing using the variable instead of a string of the variable-name is Adding timestamp to a file in PYTHON. All solve the underlying problem by telling him how to fix his code to create a file with a timestamp in it. If not a duplicate this would probably be a "Close due to typo" kind of question that should not have answers at all Add a comment. Active Oldest Votes. Depends on timestamp format. The Overflow Blog. Podcast Making Agile work for data science.
Stack Gives Back If Test1 is a directory, it's copied recursively, and the files inside the directory keep their name: only the toplevel directory gets a timestamp appended e. If you want to append a timestamp to all the file names, that's a different problem. Your choice of timestamp format is a bad idea: it's hard to read for humans and hard to sort.
You should use a format that's easier to read and that can be sorted easily, i. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Learn more. Copy a file and append a timestamp Ask Question. Asked 6 years, 8 months ago. Active 6 years, 8 months ago. Viewed 63k times. I've got two issues with my script that copies files and adds a timestamp to the name. Improve this question. Gilles 'SO- stop being evil' k gold badges silver badges bronze badges.
Brian Brian 1 1 gold badge 1 1 silver badge 5 5 bronze badges. The rule also applies to files created by copy and paste. Usually, Windows system displays the new Created time in File Explorer by default. Though we can add Date taken or Date modified to the status bar, the setting only works in one folder each time.
If we can copy files without changing date stamp from the very first, then why go through the hassle? We can check the timestamps of a file on General and Details tabs by right-click and choose Properties. Then, how can we tell Windows to preserve the timestamp on file copy? We can do it with a command line. Robocopy is a command that we use in Command prompt without any third-part software. Please follow steps below. Depending on how you want to do the transfer, there are different commands.
Keep reading to know which to choose. Here we demonstrate how to copy files with Robocopy for common usage with examples. Please open Command prompt, then try them by typing a command and hitting enter.
0コメント