Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Star Lounger
    Join Date
    Sep 2003
    Location
    Houston, Texas, USA
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    batchfile/filenames

    Is it possible to create a batchfile that goes through a folder and removes all spaces from the file names in that folder?
    Any help is much appreciated.

    deutsch

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: batchfile/filenames

    John,

    Your idea of "easy to achieve" makes the brains of us poor mortals ache.

    StuartR

  3. #3
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: batchfile/filenames

    Stuart - writing BATch files is not your full-time job!!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: batchfile/filenames

    This reminds me of a story about a maths professor at Leiden University. It may be an urban legend.

    Professor Kloosterman taught an advanced course for a selected group of students. One morning, he wrote a theorem on the blackboard, and said, "The proof of this theorem is obvious". He then fell silent, and stared at the blackboard for a while. A deepening frown appeared on his forehead. After a few minutes, he distractedly left the classroom. The students stayed (this happened in the late 50s or early 60s of last century.) After three quarters of an hour, Kloosterman returned, his necktie loose, wiping the sweat from his brow. He addressed the students: "I'm relieved to say that the proof is obvious indeed", and continued with the rest of his lecture as if nothing had happened.

  5. #5
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: batchfile/filenames

    Provided that the removal of spaces does not result in duplicate filenames, this is very easy to achieve!

    Save the attachment into the directory with the files you want despaced, as (say) DESPACE.BAT.

    Obviously you can remove the PAUSEs, but provided there aren't TOO many files in the directory, then leave them in to check results.
    Even more obviously, just in case, take a copy of the directory BEFORE running this BATch file.

    Edited later... Oops forgot the "goto :eof" after "endlocal" ! Having done this, the post went haywire, so I've removed the code from the post, simply leaving it as an attachment...
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  6. #6
    Star Lounger
    Join Date
    Sep 2003
    Location
    Houston, Texas, USA
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: batchfile/filenames

    Awesome! Worked like a charm.

    Thank you so much

    deutsch

  7. #7
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Cairns, Queensland, Australia
    Posts
    885
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: batchfile/filenames

    You write batch files as a full-time job!?! I stand in awe. I have written quite a few myself over the years, but doing it full-time... <img src=/S/bow.gif border=0 alt=bow width=15 height=15>
    Granville

  8. #8
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: batchfile/filenames

    Deutsch

    "We aim to please -- but usually miss" - olde JG saying...
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  9. #9
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: batchfile/filenames

    Granville

    Perhaps I was exaggerating ever so slightly, but at times it seems that I do write BATch files full time!

    I also have to manage antivirus provision full time, and ...
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  10. #10
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: batchfile/filenames

    So do you have the t-shirt that says "Life is a batch..." ?

  11. #11
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: batchfile/filenames

    I don't like people staring at my chest, in incomprehension, otherwise I would have made such a T-shirt...!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  12. #12
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: batchfile/filenames

    "Life is a batch..."
    ... and then you DOS?

    Alan

  13. #13
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: batchfile/filenames

    > ... and then you DOS?

    No, no, see <post#=310770>post 310770</post#>.

  14. #14
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: batchfile/filenames

    Had it not been so late at night, I might have been sharp enough to (re)invent that one myself. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Alan

  15. #15
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Cairns, Queensland, Australia
    Posts
    885
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: batchfile/filenames

    Sounds typically IT work. I have the old SunSoft add from mid-1990s show a man in a canoe paddling a rhinoceros across a body of water and a voice bubble, off stage, "and while you're at it can you make that Internet thing work for us?". Unfortunately the picture is very dark and doesn't scan well.
    Granville

Page 1 of 2 12 LastLast

Posting Permissions

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