Find the answer to your Linux question:
Results 1 to 2 of 2
In our system we have a script that renames files that it does not know what to do with. When it renames the file it adds a "?" to the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie mactruck's Avatar
    Join Date
    Apr 2012
    Location
    City of Salt
    Posts
    187

    help renaming files.


    In our system we have a script that renames files that it does not know what to do with. When it renames the file it adds a "?" to the end of the file name. Now I cannot move these files to the FTP because of the question mark in the file name. I know how to rename each file individually with the move command. Is there a way I can do this on a bigger level? I would like to create an alias for this so I can do it with ease. Our system does not have the "rename" command. I see that this should be able to do what I want but it is not installed. I dont have the rights to install.

    here is what the file names look like:

    note: I have tried just adding .txt to the end and it sill wont let me upload to the ftp. I need to remove the "?"

    fxfe.lord01.495.?
    fxfe.lord01.496.?
    fxfe.lord01.497.?
    fxfe.lord01.498.?
    fxfe.lord01.499.?
    fxfe.lord01.500.?
    fxfe.lord01.501.?
    fxfe.lord01.502.?
    fxfe.lord01.503.?
    fxfe.lord01.504.?
    fxfe.lord01.505.?
    fxfe.lord01.506.?
    fxfe.lord01.507.?
    fxfe.lord01.508.?
    fxfe.lord01.509.?
    fxfe.lord01.510.?
    fxfe.lord01.512.?
    fxfe.lord01.513.?

  2. #2
    Linux Newbie
    Join Date
    Nov 2012
    Posts
    226
    simply
    Code:
    for f in *.\? ; do mv "$f" "${f%.?*}"; done
    maybe, simply protecting filename's question mark(s) can help ftp to transfer those files?

Posting Permissions

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