In addition to renaming our scanned files by Invoice and Sales Order numbers, we also want to save them into folders based on the Invoice Year.
So I thought to try adding a backslash in the filename field of Save Documents; see if I can automate the folder path part and later figure out how to pull the Invoice Year off of the document.
Example: INV_%[RegExp:invoice] \ SO_%[RegExp:salesorder]
(Same computer and custom tool I previously submitted to you this week)
As you might see from my example I had mistakenly left spaces on either side of the backslash.
What happened was incredibly strange.
It did create a folder INV_12345 and inside it did have a SO_12345 file; however, a second INV_12345 folder was created as well with separate creation stamps in the same root directory. I have no idea how that happened.
I was eventually able to delete one of them. Still working on the other.
I suspect it's a file allocation table issue where one of them had a leading space, and the other did not, and the UI or Windows tried to auto-fix it.
Or perhaps I need to give my file server a reboot and a there-there.
If you manage to reproduce it or have recommendations going forward do let me know.
PS.
A quick UI fix - In custom tool definition the Run Javascript tool on the UI has a faulty 404 link for "Open online help in browser..."
Save Documents - Regex Fun with Backslash
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Stefan - PDF-XChange
-
- User
- Posts: 4
- Joined: Mon Jun 03, 2024 10:20 pm
-
- Site Admin
- Posts: 335
- Joined: Sun Nov 21, 2004 3:19 pm
Re: Save Documents - Regex Fun with Backslash
Hello bkennedy,
Thank you. Yes, this is an issue in our product, we will resolve it in a next release of PDF-XChange Tools.
You can delete a directory with leading and/or trailing spaces with this console command:
For example, if your directory is "c:\dir\ dir_with_edge_spaces " then use this command:
Thank you. Yes, this is an issue in our product, we will resolve it in a next release of PDF-XChange Tools.
You can delete a directory with leading and/or trailing spaces with this console command:
Code: Select all
rd /Q /S "\\?\<full path to the directory>"
Code: Select all
rd /Q /S "\\?\c:\dir\ dir_with_edge_spaces "
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: Save Documents - Regex Fun with Backslash
Hello jourgewilson,
The post above yours by our colleague Roman should be helping with the initial enquiry in this topic.
Can you please let us know in more detail why your first post in our forums is in this topic - are you trying to achieve the same as the OP?
Kind regards,
Stefan
The post above yours by our colleague Roman should be helping with the initial enquiry in this topic.
Can you please let us know in more detail why your first post in our forums is in this topic - are you trying to achieve the same as the OP?
Kind regards,
Stefan
-
- Site Admin
- Posts: 335
- Joined: Sun Nov 21, 2004 3:19 pm
Re: Save Documents - Regex Fun with Backslash
The issue with "undeletable" directory occurred because of discrepancy between the underlying filesystem and Windows API capabilities.
The filesystem itself allows trailing spaces and dots in file and directory names while the API can filter them out (depends on the file naming scheme used). As a result, a request to delete "c:\dir\dir_with_trailing_space " will result in an attempt to delete the non-existent file "c:\dir\dir_with_trailing_space".