Folders names with Square Brackets are excluded - /source/test[1]

Feb 4, 2014 at 11:40 AM
Edited Feb 5, 2014 at 4:06 PM
I have been playing around with script and noticed that not all files get backed up. I'm not coming from a IT-background, so my apologies in advance if I am missing the obvious.

Some folder names that do get backed up are

e:\source\# Michael data
e:\source\% My Courses

However these will not backup:

e:\source\test[1]
e:\source\more test [abc]


P.S.
I think this discussion might be relevant: http://stackoverflow.com/questions/18141044/cannot-run-powershell-script-in-folder-with-square-braces
Coordinator
Feb 5, 2014 at 9:46 AM
Thank you for your report.

Does the script's log report any kind of exception ?
Feb 5, 2014 at 10:41 AM
Edited Feb 5, 2014 at 1:58 PM
 ------------------------------------------------------------------------------
 Scanning ...
Get-ChildItem : The specified wildcard pattern is not valid: [test1 test2
At C:\Scripts\7zBackup.ps1:1204 char:15
+     Get-ChildItem <<<<  $folderPath -force -ErrorAction SilentlyContinue -ErrorVariable processError | ForEach-Object
 {
    + CategoryInfo          : NotSpecified: (:) [Get-ChildItem], WildcardPatternException
    + FullyQualifiedErrorId : RuntimeException,Microsoft.PowerShell.Commands.GetChildItemCommand


 There are no files matching the selection criteria. Possible reasons:
 - All source directories are empty
 - No file match selection criteria
 - User Cancel Request
Dear Anlan,
This exception sometimes shows up, sometimes it does not. I'll try to narrow it down more.
Coordinator
Feb 5, 2014 at 11:16 AM
Hello,
digging some resources I've found the problem which is better described here : http://blog.travelmarx.com/2010/10/powershell-gci-get-childitem.html
Making long things short: square brackets are interpreted by the cmdlet as range operator.

I will briefly modify the script to make use of -LiteralPath switch.

Thank you for inspiring me.
Coordinator
Feb 5, 2014 at 12:46 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Feb 6, 2014 at 6:26 PM
Edited Feb 6, 2014 at 8:17 PM
All Done !! :) -- It all works beautifully now.

The 7zbackup script cannot be praised enough. It's really f@#king great!
The rotate feature is damn impressive, and must have been hard to code!
Coordinator
Feb 7, 2014 at 11:08 AM
Not really ... probably the easiest feature.
Nevertheless I am glad you find the script so useful.

I only wish someone had the opportunity to donate a few dollars to sustain the development. But, at the moment, noone did it.
Aug 13, 2014 at 9:47 AM
Hi Anlan,

I have managed to get 7zbackup added to the website Alternative.to.
Hope this will increase its exposure to the world a bit.

Do you think 7zbackup could be ported to the Mac easily?
I have switched to the Mac and miss it all ready!

Best,
Michael


Coordinator
Aug 14, 2014 at 8:18 AM
Edited Aug 14, 2014 at 8:19 AM
Hi Michael,
thank you so much for helping 7zbackup to gain popularity.

About your question on Mac ... well ... basically 7zbackup.ps1 is a shell script: therefore I assume that someone with enough knowledge of shell scripting for *nix systems (bash, perl, php ... ) could try to translate it to work on Macs (unfortunately not me). Must also underline that, AFAIK, there is no Official 7zip binary for Mac.


Regards.
Andrea