Windows 10: Script to copy file from one location to another renaming it in the process to have the...

Discus and support Script to copy file from one location to another renaming it in the process to have the... in Windows 10 Gaming to solve the problem; Moving a script from an XP* to Win 2019 server. It used to copy from the XP to another folder on the XP using C:\[folder\subfolder\etc]. That has been... Discussion in 'Windows 10 Gaming' started by Dale Miller1, Mar 4, 2025.

  1. Script to copy file from one location to another renaming it in the process to have the...


    Moving a script from an XP* to Win 2019 server. It used to copy from the XP to another folder on the XP using C:\[folder\subfolder\etc]. That has been replaced by UNC. belowThe following line gets the error "The syntax of the command is incorrect".we are trying to copy a file from one folder to another, and in the process change it from a static name to a name containing the date & time:copy \\Nafc107\OpenEC\TLink\Data\flat_in\STrecvfile.edi \\Nafc107\OpenEC\TLink\Data\test_in\ST%YY:~2,2%%MM%%DD%%HH%%MIN%%SS:~0,2%.fileg the resulting file today at 2:29:23pm would be ST25030414292

    :)
     
    Dale Miller1, Mar 4, 2025
    #1

  2. Windows 11 File Explorer Renames folders when I copy them to a new location

    Thanks for your response. Regarding your suggestions:

    Please check if these files may not be files, but shortcuts. The items in the folders were definitely files and not shortcuts.

    Then check the permissions of these files. Right click on the folder - Properties - Security - click on your account - check "Full control" below - OK Checked several of the folders that I was working with and all of them already had full control listed.

    I didn't yet try the Windows scan suggestions. I hesitate to do something that requires a disclaimer right now as I have a lot going on and don't have time to worry about losing any files (though having everything backed up is one of the reasons I consolidate/rename/move all newly downloaded files). I may attempt this at a later time if the problem continues as it's creating extra work.

    Some additional info regarding the renaming error:

    1. I have used these processes for years, and I have never had this problem until recently. The only thing that I can see that is different is that I am now using a fairly new laptop with Windows 11, but even with that, there was no issue with renaming until about a week ago. I can't think of anything that I could have changed to cause this as I haven't been mucking about in any settings.
    2. Once the folder is in its new location, with the wrong name, I can rename it again and it stays that way. So I can work around this error, but it adds several steps to the process.
    3. Update - I worked on some folders again just now and I checked the Full control checkbox before I began (it was checked). I had the same issue. I renamed a folder containing several files, I slid that folder (copied) into a new location in a different instance of File Explorer, and the file name changed to a former name the folder had. I renamed it again and slid this copy into a third instance of File Explorer and into a different location still, and the copy of the folder renamed itself to the same former name as before. As an experiment, I took another folder (Fall-Icons-LoveSVG-com; full control checked) and slid (copied) into the same instance of File Explorer but a different location - the same rename error occurred; the name changed to Fall_Ornaments, which was the original folder name after I downloaded it. I deleted that copy and tried moving (instead of copying) the folder to that location, but it also renamed to Fall_Ornaments. I then tried renaming it in the new location and copied and then later moved it back to my original folder and both times it renamed the folder to the original Fall_Ornaments name. So any move or copy seems to trigger the renaming.
    Regarding the search issue suggestion, I did go in and check the "Do not use indexes" box in Search options. Since that search issue is an intermittent problem, it my be a while before I know whether that helped.

    Did you have any thoughts about File Explorer crashing after right-clicking? I am so used to right-clicking that I have to make myself think to do some tasks a different way (to avoid having to right-click). When I want to install a font for all users, however, I don't know a second way to access that menu option, so I am forced to right-click and hope it doesn't crash.

    Thanks again,

    Pam
     
    PamelaBreedlove, Mar 4, 2025
    #2
  3. Bulk copying of text files, but with new extension

    Hello @Terrypin,
    Yes, a .bat, .cmd, or .ps1 script could do this for you, but as this sounds like it will be an ongoing process, you will probably be better off using a ready made utility. This will save you keep changing the script for new locations, folder names, extensions, etc. Maybe something like Bulk Rename Utility or similar. Or, for MANY choices 53 Best Free File Rename Software. I hope this helps.
     
    Paul Black, Mar 4, 2025
    #3
  4. Script to copy file from one location to another renaming it in the process to have the...

    Script can copy file directory in one spot but not the other

    It's having trouble copying any of the files in the sub directories of frank. All the files directly under frank are properly backed up and the originals are properly edited.

    The script runs using a foreach, looking for any file that ends with a specific extension, in the directory specified. It uses File::find to locate each file. The script first copies the file and adds "orig" to the extension name, for example the file is .origpy instead of .py. The original file is changed from read only to full write permissions. Then it is opened for reading, all is read into memory except the comments. The file is closed. The file is opened for writing. Everything from the file in memory is written to file. The file is closed, and changed back to read only.

    This works great in Linux. I tried it in XP, its fine as well. just something about the directory structure on this server that wont let it work for the sub directories in frank.
     
    Hybrid_theory, Mar 4, 2025
    #4
Thema:

Script to copy file from one location to another renaming it in the process to have the...

Loading...
  1. Script to copy file from one location to another renaming it in the process to have the... - Similar Threads - Script copy file

  2. Script to copy file from one location to another renaming it in the process to have the...

    in Windows 10 Software and Apps
    Script to copy file from one location to another renaming it in the process to have the...: Moving a script from an XP* to Win 2019 server. It used to copy from the XP to another folder on the XP using C:\[folder\subfolder\etc]. That has been replaced by UNC. belowThe following line gets the error "The syntax of the command is incorrect".we are trying to copy a file...
  3. how to copy/move all media files from one location to another?

    in Windows 10 Gaming
    how to copy/move all media files from one location to another?: Hi there,I want to be able to find all media-related files pictures, images, videos, etc and dump them on a USB drive.Windows XP was awesome for that as the Search tool itself gave you that ability by selecting an option to just do that and find all media files, pictures,...
  4. how to copy/move all media files from one location to another?

    in Windows 10 Software and Apps
    how to copy/move all media files from one location to another?: Hi there,I want to be able to find all media-related files pictures, images, videos, etc and dump them on a USB drive.Windows XP was awesome for that as the Search tool itself gave you that ability by selecting an option to just do that and find all media files, pictures,...
  5. Copying files from one user account to another

    in Windows 10 Software and Apps
    Copying files from one user account to another: I am trying to copy the user account files from one user account to another user account both admin accounts. I am using the hidden Administrator account to do this, but when I copy the files from one account and attempt to paste them into the public account while logged into...
  6. How to copy a file from one server to another ?

    in Windows 10 Network and Sharing
    How to copy a file from one server to another ?: Hello, I have a basic question of how to copy a file in one server to another server that I need your help?For example , I have this file in my server : test-myserver-sql1C:\Program Files\Microsoft SQL Server\130\DTS\Binn\dtutil.exeAnd I want to copy it to my second server :...
  7. How to copy a file from one server to another ?

    in Windows 10 Gaming
    How to copy a file from one server to another ?: Hello, I have a basic question of how to copy a file in one server to another server that I need your help?For example , I have this file in my server : test-myserver-sql1C:\Program Files\Microsoft SQL Server\130\DTS\Binn\dtutil.exeAnd I want to copy it to my second server :...
  8. How to copy a file from one server to another ?

    in Windows 10 Software and Apps
    How to copy a file from one server to another ?: Hello, I have a basic question of how to copy a file in one server to another server that I need your help?For example , I have this file in my server : test-myserver-sql1C:\Program Files\Microsoft SQL Server\130\DTS\Binn\dtutil.exeAnd I want to copy it to my second server :...
  9. Copying files from one drive to another

    in Windows 10 Ask Insider
    Copying files from one drive to another: Hello, I am copying my useless files from my small storaged ssd to my harddrive, but when i copy over the files their sizes are 10x bigger, the files im copying is only 7.20 gb large but it's copying 70gb worth of storage to my hdd? Please give answers :) submitted by...
  10. Copying files from one computer to another.

    in Windows 10 Drivers and Hardware
    Copying files from one computer to another.: I have several NTFS formatted portable HDDs that when new files are copied onto them from one machine and I attempt to read them on another machine the new files don't appear. I've tried to use chkdsk in command mode with the /f switch, but that will not run because I'm...