I need help with ordering re-named files. Currently we have a work flow where we have a folder with a bunch of PDF documents (normally over 100) and the names all start with numbers then dates. We need to import these into PDFdocs into a binder and remove all the numbers from the start manually.
I have been able to make a powershell script that will remove all the numbers and dates from the files but I need a way to preserve the ordering of them.
If you click and drag them from file explorer then it will import them in what ever order they were displayed as. I tried using Date modified for this, and even forcing the modified date to be updated in power shell. But windows only displays the date modified down to 1 minute. I read that FAT has a resolution of 2 seconds so I tried setting a sleep function for 2 seconds but that didn't work
I could set it for 1 minute but that will take hours with the number of documents we need to process.
I noticed that file explorer has a number column (#) I believe this is normally for music tracks. Is it possible to set this property on just any file and is it possible to do it in PS? I've tried googling around but file number tends to find questions about the number of files
Heres the code in question, I tried doing $file.Number but that didn't work and File.# just starts a comment
$newFileName = $newFileName.remove(0,13)
$file.LastWriteTime = (Get-Date)
Rename-Item -Path $folderPath\$file -NewName $newFileName #sets the new name of the file
Start-Sleep -Seconds 2
Is it possible to set the file number for non music tracks? or is there another thing I can do to set names but preserve order? Any column that file explorer can order by will be valid. Thanks