Rename file
Moderators: JRL, Dorian (MJT support)
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Rename file
If I have a fairly long file path and would like to rename it I get the "max path" error (CF_RESULT_CODE=183). How should I go about this?
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Rename file
Found a solution. Using Python:
Code: Select all
/*
python_code_copy_file:
import shutil
source = r'%PY_COPY_FILE_SOURCE%'
target = r'%PY_COPY_FILE_TARGET%'
shutil.copyfile(source, target)
*/
LabelToVar>python_code_copy_file,py_copy_file
PyExec>py_copy_file,temp
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Rename file
Well, I asked for rename... here's the rename variant:
Code: Select all
/*
python_code_rename_file:
import os
os.rename(r'%PY_RENAME_FILE_SOURCE%',r'%PY_RENAME_FILE_TARGET%')
*/
LabelToVar>python_code_rename_file,py_rename_file
PyExec>py_rename_file,temp
Re: Rename file
I think this may be useful and relevant. I recently learned about a command called robocopy. It doesn't have the long path issue. Haven't used it as of yet. You'd think they'd just fix the issue instead of making a separate command to overcome it. But that's what Microsuck does.
PepsiHog
PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Rename file
Ah, thanks. I'm going to test that next time.