SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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. #2
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Nova Scotia, Canada
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this
    Code:
    pdftk "D:\test folder"\*.pdf other_parameter other_parameter

  3. #3
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tried it, didn't work. I'm at a loss why other command line commands work in this manner but this utility doesn't want to accept it.

    Any other ideas?

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Probably because the utility is badly written, or at least the argument parser is. Also, spaces in folder paths are evil. People wonder why I put down a fatwa against them years ago.

    If you can get powershell on the box, you could code around this pretty easy by getting the list of files and then applying it one by one.

    If you can't get powershell, perhaps you could robocopy the files over to another, spaceless folder, run utiltiy, then robocopy back?


Bookmarks

Posting Permissions

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