Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Command line: Using asterisk to select all files inside quotes for a directory name

    I'm running a command line utility on my ASP web site which takes an input of a list of file names along with other parameters. The following command works fine:

    Code:
    pdftk D:\testfolder\*.pdf other_parameter other_parameter
    But then my folder path actually has a space in it so I need to do this:

    Code:
    pdftk "D:\test folder\*.pdf" other_parameter other_parameter
    but this doesn't work because the quotes makes the asterisk a string character and does not use it as a special character anymore.

    How do I work around this without renaming folders or anything along those lines where it requires me to change the input? Thanks

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Try surrounding only the space-separated directory names with quotes:

    Code:
    pdftk D:\"test folder"\*.pdf other_parameter other_parameter
    Are you a Help Vampire?

  • #3
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Tried it. Doesn't seem to work.

    It splits it up where the quotation marks are inserted. Below is what happens:


    Code:
    D:\PDF Merge Toolkit>pdftk D:\"test folder"\*.pdf cat output "D:\testfolder\comb
    ined.pdf"
    Error: Failed to open PDF file:
       D:"test
    Error: Failed to open PDF file:
       folder\*.pdf cat output D:\testfolder\combined.pdf
    Done.  Input errors, so no output created.
    Any other suggestions, thanks.

  • #4
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    It works straight from the command line, so it must be the program itself that's messing with it. That's what it looks like from this:
    D:"test
    The program is using the windows directory separator as a real backslash - it's escaping the first double quote.

    The workaround may be to use double backslashes in the path. That might force it to escape the directory separator and leave it in place. Like so:

    Code:
    pdftk D:\\"test folder"\\*.pdf other_parameter other_parameter
    With the behavior above, though, I'm not sure how the program is handling that parameter internally.
    Are you a Help Vampire?

  • Users who have thanked tomws for this post:

    finittz1 (06-22-2009)

  • #5
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you for the explanation. I learned something new today.

    And yes the double slash fix does work. I'm very thankful. Hopefully, like you said this doesn't mean something is messed up with the way it handles blackslashes.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •