UNIX: How to change all hidden files to visible in a multiple sub directories

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite
1












I have hundreds of sub directories in a directory that all have hidden files in them that I need to remove the period at the beginning of them to make them visible. I found a command to go into each directory and change them to make them visible but I need to know how to make this command work from one directory up.



rename 's/.//;' .*


I have tried about an hour to modify this to work one level up but don't understand the perl string enough to do it. If someone could help out I am sure it's simple and I just can't land on the right answer.










share|improve this question























  • Try it like this rename -n 's/.//;' ../* the -n will see what happens without making any changes, then when your ok with it remove the -n option
    – George Udosen
    Oct 1 '17 at 23:05











  • I tried this command and its looking at the files above the directory I'm in not below? copied and pasted directly into putty
    – Ortoch
    Oct 1 '17 at 23:23










  • What does from one directory up mean?
    – George Udosen
    Oct 1 '17 at 23:25










  • If it's just a matter of visibility: alias ls='ls -a' and shopt -s dotglob (in bash).
    – Kusalananda
    Oct 2 '17 at 5:45











  • If you're happy with one or several of the answers, upvote them. If one is solving your issue, accepting it would be the best way of saying "Thank You!" :-)
    – Kusalananda
    Oct 8 '17 at 15:40














up vote
2
down vote

favorite
1












I have hundreds of sub directories in a directory that all have hidden files in them that I need to remove the period at the beginning of them to make them visible. I found a command to go into each directory and change them to make them visible but I need to know how to make this command work from one directory up.



rename 's/.//;' .*


I have tried about an hour to modify this to work one level up but don't understand the perl string enough to do it. If someone could help out I am sure it's simple and I just can't land on the right answer.










share|improve this question























  • Try it like this rename -n 's/.//;' ../* the -n will see what happens without making any changes, then when your ok with it remove the -n option
    – George Udosen
    Oct 1 '17 at 23:05











  • I tried this command and its looking at the files above the directory I'm in not below? copied and pasted directly into putty
    – Ortoch
    Oct 1 '17 at 23:23










  • What does from one directory up mean?
    – George Udosen
    Oct 1 '17 at 23:25










  • If it's just a matter of visibility: alias ls='ls -a' and shopt -s dotglob (in bash).
    – Kusalananda
    Oct 2 '17 at 5:45











  • If you're happy with one or several of the answers, upvote them. If one is solving your issue, accepting it would be the best way of saying "Thank You!" :-)
    – Kusalananda
    Oct 8 '17 at 15:40












up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





I have hundreds of sub directories in a directory that all have hidden files in them that I need to remove the period at the beginning of them to make them visible. I found a command to go into each directory and change them to make them visible but I need to know how to make this command work from one directory up.



rename 's/.//;' .*


I have tried about an hour to modify this to work one level up but don't understand the perl string enough to do it. If someone could help out I am sure it's simple and I just can't land on the right answer.










share|improve this question















I have hundreds of sub directories in a directory that all have hidden files in them that I need to remove the period at the beginning of them to make them visible. I found a command to go into each directory and change them to make them visible but I need to know how to make this command work from one directory up.



rename 's/.//;' .*


I have tried about an hour to modify this to work one level up but don't understand the perl string enough to do it. If someone could help out I am sure it's simple and I just can't land on the right answer.







linux files rename dot-files






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 8 '17 at 12:33









Jeff Schaller

32.3k849109




32.3k849109










asked Oct 1 '17 at 22:39









Ortoch

313




313











  • Try it like this rename -n 's/.//;' ../* the -n will see what happens without making any changes, then when your ok with it remove the -n option
    – George Udosen
    Oct 1 '17 at 23:05











  • I tried this command and its looking at the files above the directory I'm in not below? copied and pasted directly into putty
    – Ortoch
    Oct 1 '17 at 23:23










  • What does from one directory up mean?
    – George Udosen
    Oct 1 '17 at 23:25










  • If it's just a matter of visibility: alias ls='ls -a' and shopt -s dotglob (in bash).
    – Kusalananda
    Oct 2 '17 at 5:45











  • If you're happy with one or several of the answers, upvote them. If one is solving your issue, accepting it would be the best way of saying "Thank You!" :-)
    – Kusalananda
    Oct 8 '17 at 15:40
















  • Try it like this rename -n 's/.//;' ../* the -n will see what happens without making any changes, then when your ok with it remove the -n option
    – George Udosen
    Oct 1 '17 at 23:05











  • I tried this command and its looking at the files above the directory I'm in not below? copied and pasted directly into putty
    – Ortoch
    Oct 1 '17 at 23:23










  • What does from one directory up mean?
    – George Udosen
    Oct 1 '17 at 23:25










  • If it's just a matter of visibility: alias ls='ls -a' and shopt -s dotglob (in bash).
    – Kusalananda
    Oct 2 '17 at 5:45











  • If you're happy with one or several of the answers, upvote them. If one is solving your issue, accepting it would be the best way of saying "Thank You!" :-)
    – Kusalananda
    Oct 8 '17 at 15:40















Try it like this rename -n 's/.//;' ../* the -n will see what happens without making any changes, then when your ok with it remove the -n option
– George Udosen
Oct 1 '17 at 23:05





Try it like this rename -n 's/.//;' ../* the -n will see what happens without making any changes, then when your ok with it remove the -n option
– George Udosen
Oct 1 '17 at 23:05













I tried this command and its looking at the files above the directory I'm in not below? copied and pasted directly into putty
– Ortoch
Oct 1 '17 at 23:23




I tried this command and its looking at the files above the directory I'm in not below? copied and pasted directly into putty
– Ortoch
Oct 1 '17 at 23:23












What does from one directory up mean?
– George Udosen
Oct 1 '17 at 23:25




What does from one directory up mean?
– George Udosen
Oct 1 '17 at 23:25












If it's just a matter of visibility: alias ls='ls -a' and shopt -s dotglob (in bash).
– Kusalananda
Oct 2 '17 at 5:45





If it's just a matter of visibility: alias ls='ls -a' and shopt -s dotglob (in bash).
– Kusalananda
Oct 2 '17 at 5:45













If you're happy with one or several of the answers, upvote them. If one is solving your issue, accepting it would be the best way of saying "Thank You!" :-)
– Kusalananda
Oct 8 '17 at 15:40




If you're happy with one or several of the answers, upvote them. If one is solving your issue, accepting it would be the best way of saying "Thank You!" :-)
– Kusalananda
Oct 8 '17 at 15:40










6 Answers
6






active

oldest

votes

















up vote
3
down vote













With GNU find:



find /some/path -type f -name '.*' -execdir sh -c 'mv -i "$0" "./$0#./."' ;


With Perl rename:



find /some/path -type f -name '.*' -exec prename -i -n 's!.*/K.!!' +


(remove -n when you're happy with the results).






share|improve this answer





























    up vote
    2
    down vote













    this is the line that fixed it all finally found the answer



    find -mindepth 1 -depth -exec rename -n 's/.([^/]*$)/$1' +





    share|improve this answer




















    • This applies rename to files and directories alike, regardless of whether they actually need to be renamed or not.
      – Kusalananda
      Oct 2 '17 at 6:32

















    up vote
    2
    down vote













    Just use find together with a simple shell script for doing the renaming and checking that no existing file is overwritten:



    find . -type f -name '.*' 
    -execdir sh -c '[ ! -e "$1#." ] && mv "$1" "$1#."' sh ';'


    The -execdir option will execute its argument inside the parent directory of the found name, and will be the base name (name without path) of the found name. This option is a widely implemented extension to standard find.



    The sh -c script will simply make sure that the desired name is not already taken, and then it will rename the file.



    The $1#. parameter substitution will take the value of $1 (the first command line argument of the sh -c script, which is a filename) and remove the initial dot.






    share|improve this answer





























      up vote
      0
      down vote













      This will do what you want:



      find . -iname ".*" -exec realpath ; | rename -n 's/.(.*)/$1/'


      File structure:



      .
      ├── game
      │   ├── .keie
      │   ├── .kjae
      │   ├── .ndhe
      │   └── shame
      │   ├── .alwo
      │   ├── .asdjd
      │   └── .kajd
      ├── .jsdsd
      ├── .lewe
      └── .skdsd


      Test run:



      rename(/home/george/Documents/askubuntu/rename/down/.lewe, /home/george/Documents/askubuntu/rename/down/lewe)
      rename(/home/george/Documents/askubuntu/rename/down/.jsdsd, /home/george/Documents/askubuntu/rename/down/jsdsd)
      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.asdjd, /home/george/Documents/askubuntu/rename/down/game/shame/asdjd)
      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.kajd, /home/george/Documents/askubuntu/rename/down/game/shame/kajd)
      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.alwo, /home/george/Documents/askubuntu/rename/down/game/shame/alwo)
      rename(/home/george/Documents/askubuntu/rename/down/game/.ndhe, /home/george/Documents/askubuntu/rename/down/game/ndhe)
      rename(/home/george/Documents/askubuntu/rename/down/game/.keie, /home/george/Documents/askubuntu/rename/down/game/keie)
      rename(/home/george/Documents/askubuntu/rename/down/game/.kjae, /home/george/Documents/askubuntu/rename/down/game/kjae)
      rename(/home/george/Documents/askubuntu/rename/down/.skdsd, /home/george/Documents/askubuntu/rename/down/skdsd)


      Results:



      .
      ├── game
      │   ├── keie
      │   ├── kjae
      │   ├── ndhe
      │   └── shame
      │   ├── alwo
      │   ├── asdjd
      │   └── kajd
      ├── jsdsd
      ├── lewe
      └── skdsd


      Information:



      realpath : get the real path to file of interest



      -n: used to test run, remove when you're ready to rename the files.






      share|improve this answer






















      • same error as all the other answers which means you are all probably right but I'm doing something wrong
        – Ortoch
        Oct 1 '17 at 23:33










      • with -n the command looks like it will run perfectly here is output...find . -type f -iname ".*" -exec basename ; | rename -n 's/.//;' rename(.test3, test3) rename(.test1, test1) rename(.test2, test2) rename(.test3, test3) rename(.test1, test1)
        – Ortoch
        Oct 1 '17 at 23:34










      • remove the -n when your ready to rename
        – George Udosen
        Oct 1 '17 at 23:34










      • yes without the -n I get this error for all 9 test files find . -type f -iname ".*" -exec basename ; | rename 's/.//;' Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory
        – Ortoch
        Oct 1 '17 at 23:36










      • I am in TEST running this command on TEST/T1/.test1 TEST/T1/.test2 TEST/T1/.test3 etc....
        – Ortoch
        Oct 1 '17 at 23:37

















      up vote
      -1
      down vote













      find . -type f -name .* -exec rename -n 's/.//;' +





      share|improve this answer




















      • same error as the above solution Can't rename ./T2/.test3 /T2/.test3: No such file or directory almost looks like its trying to rename the Directory or something?
        – Ortoch
        Oct 1 '17 at 23:22






      • 1




        That's because rename gets to see files as ./path/foo.
        – Satō Katsura
        Oct 2 '17 at 3:25

















      up vote
      -1
      down vote













      rename doesn't have a recursive option. If you want to rename the files in the current directory and all its subdirectories, put the following script in the parent directory and execute it.



      #!/bin/bash
      for i in `find . -name ".*"`
      do
      rename 's/.//' $i
      done





      share|improve this answer




















      • Can't rename ./T2/.test3 /T2/.test3: No such file or directory got this error over and over in the test directory I'm playing with testing things out. Have 3 test directories with 3 test hidden files in each and all 9 files returned this string.
        – Ortoch
        Oct 1 '17 at 23:21











      • I don't understand why that code sample shouldn't work, but just for reference: use $() instead of back ticks.
        – ADDB
        Oct 2 '17 at 17:42










      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f395530%2funix-how-to-change-all-hidden-files-to-visible-in-a-multiple-sub-directories%23new-answer', 'question_page');

      );

      Post as a guest






























      6 Answers
      6






      active

      oldest

      votes








      6 Answers
      6






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote













      With GNU find:



      find /some/path -type f -name '.*' -execdir sh -c 'mv -i "$0" "./$0#./."' ;


      With Perl rename:



      find /some/path -type f -name '.*' -exec prename -i -n 's!.*/K.!!' +


      (remove -n when you're happy with the results).






      share|improve this answer


























        up vote
        3
        down vote













        With GNU find:



        find /some/path -type f -name '.*' -execdir sh -c 'mv -i "$0" "./$0#./."' ;


        With Perl rename:



        find /some/path -type f -name '.*' -exec prename -i -n 's!.*/K.!!' +


        (remove -n when you're happy with the results).






        share|improve this answer
























          up vote
          3
          down vote










          up vote
          3
          down vote









          With GNU find:



          find /some/path -type f -name '.*' -execdir sh -c 'mv -i "$0" "./$0#./."' ;


          With Perl rename:



          find /some/path -type f -name '.*' -exec prename -i -n 's!.*/K.!!' +


          (remove -n when you're happy with the results).






          share|improve this answer














          With GNU find:



          find /some/path -type f -name '.*' -execdir sh -c 'mv -i "$0" "./$0#./."' ;


          With Perl rename:



          find /some/path -type f -name '.*' -exec prename -i -n 's!.*/K.!!' +


          (remove -n when you're happy with the results).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 2 '17 at 3:22

























          answered Oct 2 '17 at 3:15









          Satō Katsura

          10.7k11533




          10.7k11533






















              up vote
              2
              down vote













              this is the line that fixed it all finally found the answer



              find -mindepth 1 -depth -exec rename -n 's/.([^/]*$)/$1' +





              share|improve this answer




















              • This applies rename to files and directories alike, regardless of whether they actually need to be renamed or not.
                – Kusalananda
                Oct 2 '17 at 6:32














              up vote
              2
              down vote













              this is the line that fixed it all finally found the answer



              find -mindepth 1 -depth -exec rename -n 's/.([^/]*$)/$1' +





              share|improve this answer




















              • This applies rename to files and directories alike, regardless of whether they actually need to be renamed or not.
                – Kusalananda
                Oct 2 '17 at 6:32












              up vote
              2
              down vote










              up vote
              2
              down vote









              this is the line that fixed it all finally found the answer



              find -mindepth 1 -depth -exec rename -n 's/.([^/]*$)/$1' +





              share|improve this answer












              this is the line that fixed it all finally found the answer



              find -mindepth 1 -depth -exec rename -n 's/.([^/]*$)/$1' +






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Oct 2 '17 at 0:04









              Ortoch

              313




              313











              • This applies rename to files and directories alike, regardless of whether they actually need to be renamed or not.
                – Kusalananda
                Oct 2 '17 at 6:32
















              • This applies rename to files and directories alike, regardless of whether they actually need to be renamed or not.
                – Kusalananda
                Oct 2 '17 at 6:32















              This applies rename to files and directories alike, regardless of whether they actually need to be renamed or not.
              – Kusalananda
              Oct 2 '17 at 6:32




              This applies rename to files and directories alike, regardless of whether they actually need to be renamed or not.
              – Kusalananda
              Oct 2 '17 at 6:32










              up vote
              2
              down vote













              Just use find together with a simple shell script for doing the renaming and checking that no existing file is overwritten:



              find . -type f -name '.*' 
              -execdir sh -c '[ ! -e "$1#." ] && mv "$1" "$1#."' sh ';'


              The -execdir option will execute its argument inside the parent directory of the found name, and will be the base name (name without path) of the found name. This option is a widely implemented extension to standard find.



              The sh -c script will simply make sure that the desired name is not already taken, and then it will rename the file.



              The $1#. parameter substitution will take the value of $1 (the first command line argument of the sh -c script, which is a filename) and remove the initial dot.






              share|improve this answer


























                up vote
                2
                down vote













                Just use find together with a simple shell script for doing the renaming and checking that no existing file is overwritten:



                find . -type f -name '.*' 
                -execdir sh -c '[ ! -e "$1#." ] && mv "$1" "$1#."' sh ';'


                The -execdir option will execute its argument inside the parent directory of the found name, and will be the base name (name without path) of the found name. This option is a widely implemented extension to standard find.



                The sh -c script will simply make sure that the desired name is not already taken, and then it will rename the file.



                The $1#. parameter substitution will take the value of $1 (the first command line argument of the sh -c script, which is a filename) and remove the initial dot.






                share|improve this answer
























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  Just use find together with a simple shell script for doing the renaming and checking that no existing file is overwritten:



                  find . -type f -name '.*' 
                  -execdir sh -c '[ ! -e "$1#." ] && mv "$1" "$1#."' sh ';'


                  The -execdir option will execute its argument inside the parent directory of the found name, and will be the base name (name without path) of the found name. This option is a widely implemented extension to standard find.



                  The sh -c script will simply make sure that the desired name is not already taken, and then it will rename the file.



                  The $1#. parameter substitution will take the value of $1 (the first command line argument of the sh -c script, which is a filename) and remove the initial dot.






                  share|improve this answer














                  Just use find together with a simple shell script for doing the renaming and checking that no existing file is overwritten:



                  find . -type f -name '.*' 
                  -execdir sh -c '[ ! -e "$1#." ] && mv "$1" "$1#."' sh ';'


                  The -execdir option will execute its argument inside the parent directory of the found name, and will be the base name (name without path) of the found name. This option is a widely implemented extension to standard find.



                  The sh -c script will simply make sure that the desired name is not already taken, and then it will rename the file.



                  The $1#. parameter substitution will take the value of $1 (the first command line argument of the sh -c script, which is a filename) and remove the initial dot.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Oct 8 '17 at 13:05

























                  answered Oct 2 '17 at 6:23









                  Kusalananda

                  105k14209326




                  105k14209326




















                      up vote
                      0
                      down vote













                      This will do what you want:



                      find . -iname ".*" -exec realpath ; | rename -n 's/.(.*)/$1/'


                      File structure:



                      .
                      ├── game
                      │   ├── .keie
                      │   ├── .kjae
                      │   ├── .ndhe
                      │   └── shame
                      │   ├── .alwo
                      │   ├── .asdjd
                      │   └── .kajd
                      ├── .jsdsd
                      ├── .lewe
                      └── .skdsd


                      Test run:



                      rename(/home/george/Documents/askubuntu/rename/down/.lewe, /home/george/Documents/askubuntu/rename/down/lewe)
                      rename(/home/george/Documents/askubuntu/rename/down/.jsdsd, /home/george/Documents/askubuntu/rename/down/jsdsd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.asdjd, /home/george/Documents/askubuntu/rename/down/game/shame/asdjd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.kajd, /home/george/Documents/askubuntu/rename/down/game/shame/kajd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.alwo, /home/george/Documents/askubuntu/rename/down/game/shame/alwo)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.ndhe, /home/george/Documents/askubuntu/rename/down/game/ndhe)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.keie, /home/george/Documents/askubuntu/rename/down/game/keie)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.kjae, /home/george/Documents/askubuntu/rename/down/game/kjae)
                      rename(/home/george/Documents/askubuntu/rename/down/.skdsd, /home/george/Documents/askubuntu/rename/down/skdsd)


                      Results:



                      .
                      ├── game
                      │   ├── keie
                      │   ├── kjae
                      │   ├── ndhe
                      │   └── shame
                      │   ├── alwo
                      │   ├── asdjd
                      │   └── kajd
                      ├── jsdsd
                      ├── lewe
                      └── skdsd


                      Information:



                      realpath : get the real path to file of interest



                      -n: used to test run, remove when you're ready to rename the files.






                      share|improve this answer






















                      • same error as all the other answers which means you are all probably right but I'm doing something wrong
                        – Ortoch
                        Oct 1 '17 at 23:33










                      • with -n the command looks like it will run perfectly here is output...find . -type f -iname ".*" -exec basename ; | rename -n 's/.//;' rename(.test3, test3) rename(.test1, test1) rename(.test2, test2) rename(.test3, test3) rename(.test1, test1)
                        – Ortoch
                        Oct 1 '17 at 23:34










                      • remove the -n when your ready to rename
                        – George Udosen
                        Oct 1 '17 at 23:34










                      • yes without the -n I get this error for all 9 test files find . -type f -iname ".*" -exec basename ; | rename 's/.//;' Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory
                        – Ortoch
                        Oct 1 '17 at 23:36










                      • I am in TEST running this command on TEST/T1/.test1 TEST/T1/.test2 TEST/T1/.test3 etc....
                        – Ortoch
                        Oct 1 '17 at 23:37














                      up vote
                      0
                      down vote













                      This will do what you want:



                      find . -iname ".*" -exec realpath ; | rename -n 's/.(.*)/$1/'


                      File structure:



                      .
                      ├── game
                      │   ├── .keie
                      │   ├── .kjae
                      │   ├── .ndhe
                      │   └── shame
                      │   ├── .alwo
                      │   ├── .asdjd
                      │   └── .kajd
                      ├── .jsdsd
                      ├── .lewe
                      └── .skdsd


                      Test run:



                      rename(/home/george/Documents/askubuntu/rename/down/.lewe, /home/george/Documents/askubuntu/rename/down/lewe)
                      rename(/home/george/Documents/askubuntu/rename/down/.jsdsd, /home/george/Documents/askubuntu/rename/down/jsdsd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.asdjd, /home/george/Documents/askubuntu/rename/down/game/shame/asdjd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.kajd, /home/george/Documents/askubuntu/rename/down/game/shame/kajd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.alwo, /home/george/Documents/askubuntu/rename/down/game/shame/alwo)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.ndhe, /home/george/Documents/askubuntu/rename/down/game/ndhe)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.keie, /home/george/Documents/askubuntu/rename/down/game/keie)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.kjae, /home/george/Documents/askubuntu/rename/down/game/kjae)
                      rename(/home/george/Documents/askubuntu/rename/down/.skdsd, /home/george/Documents/askubuntu/rename/down/skdsd)


                      Results:



                      .
                      ├── game
                      │   ├── keie
                      │   ├── kjae
                      │   ├── ndhe
                      │   └── shame
                      │   ├── alwo
                      │   ├── asdjd
                      │   └── kajd
                      ├── jsdsd
                      ├── lewe
                      └── skdsd


                      Information:



                      realpath : get the real path to file of interest



                      -n: used to test run, remove when you're ready to rename the files.






                      share|improve this answer






















                      • same error as all the other answers which means you are all probably right but I'm doing something wrong
                        – Ortoch
                        Oct 1 '17 at 23:33










                      • with -n the command looks like it will run perfectly here is output...find . -type f -iname ".*" -exec basename ; | rename -n 's/.//;' rename(.test3, test3) rename(.test1, test1) rename(.test2, test2) rename(.test3, test3) rename(.test1, test1)
                        – Ortoch
                        Oct 1 '17 at 23:34










                      • remove the -n when your ready to rename
                        – George Udosen
                        Oct 1 '17 at 23:34










                      • yes without the -n I get this error for all 9 test files find . -type f -iname ".*" -exec basename ; | rename 's/.//;' Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory
                        – Ortoch
                        Oct 1 '17 at 23:36










                      • I am in TEST running this command on TEST/T1/.test1 TEST/T1/.test2 TEST/T1/.test3 etc....
                        – Ortoch
                        Oct 1 '17 at 23:37












                      up vote
                      0
                      down vote










                      up vote
                      0
                      down vote









                      This will do what you want:



                      find . -iname ".*" -exec realpath ; | rename -n 's/.(.*)/$1/'


                      File structure:



                      .
                      ├── game
                      │   ├── .keie
                      │   ├── .kjae
                      │   ├── .ndhe
                      │   └── shame
                      │   ├── .alwo
                      │   ├── .asdjd
                      │   └── .kajd
                      ├── .jsdsd
                      ├── .lewe
                      └── .skdsd


                      Test run:



                      rename(/home/george/Documents/askubuntu/rename/down/.lewe, /home/george/Documents/askubuntu/rename/down/lewe)
                      rename(/home/george/Documents/askubuntu/rename/down/.jsdsd, /home/george/Documents/askubuntu/rename/down/jsdsd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.asdjd, /home/george/Documents/askubuntu/rename/down/game/shame/asdjd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.kajd, /home/george/Documents/askubuntu/rename/down/game/shame/kajd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.alwo, /home/george/Documents/askubuntu/rename/down/game/shame/alwo)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.ndhe, /home/george/Documents/askubuntu/rename/down/game/ndhe)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.keie, /home/george/Documents/askubuntu/rename/down/game/keie)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.kjae, /home/george/Documents/askubuntu/rename/down/game/kjae)
                      rename(/home/george/Documents/askubuntu/rename/down/.skdsd, /home/george/Documents/askubuntu/rename/down/skdsd)


                      Results:



                      .
                      ├── game
                      │   ├── keie
                      │   ├── kjae
                      │   ├── ndhe
                      │   └── shame
                      │   ├── alwo
                      │   ├── asdjd
                      │   └── kajd
                      ├── jsdsd
                      ├── lewe
                      └── skdsd


                      Information:



                      realpath : get the real path to file of interest



                      -n: used to test run, remove when you're ready to rename the files.






                      share|improve this answer














                      This will do what you want:



                      find . -iname ".*" -exec realpath ; | rename -n 's/.(.*)/$1/'


                      File structure:



                      .
                      ├── game
                      │   ├── .keie
                      │   ├── .kjae
                      │   ├── .ndhe
                      │   └── shame
                      │   ├── .alwo
                      │   ├── .asdjd
                      │   └── .kajd
                      ├── .jsdsd
                      ├── .lewe
                      └── .skdsd


                      Test run:



                      rename(/home/george/Documents/askubuntu/rename/down/.lewe, /home/george/Documents/askubuntu/rename/down/lewe)
                      rename(/home/george/Documents/askubuntu/rename/down/.jsdsd, /home/george/Documents/askubuntu/rename/down/jsdsd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.asdjd, /home/george/Documents/askubuntu/rename/down/game/shame/asdjd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.kajd, /home/george/Documents/askubuntu/rename/down/game/shame/kajd)
                      rename(/home/george/Documents/askubuntu/rename/down/game/shame/.alwo, /home/george/Documents/askubuntu/rename/down/game/shame/alwo)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.ndhe, /home/george/Documents/askubuntu/rename/down/game/ndhe)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.keie, /home/george/Documents/askubuntu/rename/down/game/keie)
                      rename(/home/george/Documents/askubuntu/rename/down/game/.kjae, /home/george/Documents/askubuntu/rename/down/game/kjae)
                      rename(/home/george/Documents/askubuntu/rename/down/.skdsd, /home/george/Documents/askubuntu/rename/down/skdsd)


                      Results:



                      .
                      ├── game
                      │   ├── keie
                      │   ├── kjae
                      │   ├── ndhe
                      │   └── shame
                      │   ├── alwo
                      │   ├── asdjd
                      │   └── kajd
                      ├── jsdsd
                      ├── lewe
                      └── skdsd


                      Information:



                      realpath : get the real path to file of interest



                      -n: used to test run, remove when you're ready to rename the files.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Oct 2 '17 at 8:22

























                      answered Oct 1 '17 at 23:31









                      George Udosen

                      1,112318




                      1,112318











                      • same error as all the other answers which means you are all probably right but I'm doing something wrong
                        – Ortoch
                        Oct 1 '17 at 23:33










                      • with -n the command looks like it will run perfectly here is output...find . -type f -iname ".*" -exec basename ; | rename -n 's/.//;' rename(.test3, test3) rename(.test1, test1) rename(.test2, test2) rename(.test3, test3) rename(.test1, test1)
                        – Ortoch
                        Oct 1 '17 at 23:34










                      • remove the -n when your ready to rename
                        – George Udosen
                        Oct 1 '17 at 23:34










                      • yes without the -n I get this error for all 9 test files find . -type f -iname ".*" -exec basename ; | rename 's/.//;' Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory
                        – Ortoch
                        Oct 1 '17 at 23:36










                      • I am in TEST running this command on TEST/T1/.test1 TEST/T1/.test2 TEST/T1/.test3 etc....
                        – Ortoch
                        Oct 1 '17 at 23:37
















                      • same error as all the other answers which means you are all probably right but I'm doing something wrong
                        – Ortoch
                        Oct 1 '17 at 23:33










                      • with -n the command looks like it will run perfectly here is output...find . -type f -iname ".*" -exec basename ; | rename -n 's/.//;' rename(.test3, test3) rename(.test1, test1) rename(.test2, test2) rename(.test3, test3) rename(.test1, test1)
                        – Ortoch
                        Oct 1 '17 at 23:34










                      • remove the -n when your ready to rename
                        – George Udosen
                        Oct 1 '17 at 23:34










                      • yes without the -n I get this error for all 9 test files find . -type f -iname ".*" -exec basename ; | rename 's/.//;' Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory
                        – Ortoch
                        Oct 1 '17 at 23:36










                      • I am in TEST running this command on TEST/T1/.test1 TEST/T1/.test2 TEST/T1/.test3 etc....
                        – Ortoch
                        Oct 1 '17 at 23:37















                      same error as all the other answers which means you are all probably right but I'm doing something wrong
                      – Ortoch
                      Oct 1 '17 at 23:33




                      same error as all the other answers which means you are all probably right but I'm doing something wrong
                      – Ortoch
                      Oct 1 '17 at 23:33












                      with -n the command looks like it will run perfectly here is output...find . -type f -iname ".*" -exec basename ; | rename -n 's/.//;' rename(.test3, test3) rename(.test1, test1) rename(.test2, test2) rename(.test3, test3) rename(.test1, test1)
                      – Ortoch
                      Oct 1 '17 at 23:34




                      with -n the command looks like it will run perfectly here is output...find . -type f -iname ".*" -exec basename ; | rename -n 's/.//;' rename(.test3, test3) rename(.test1, test1) rename(.test2, test2) rename(.test3, test3) rename(.test1, test1)
                      – Ortoch
                      Oct 1 '17 at 23:34












                      remove the -n when your ready to rename
                      – George Udosen
                      Oct 1 '17 at 23:34




                      remove the -n when your ready to rename
                      – George Udosen
                      Oct 1 '17 at 23:34












                      yes without the -n I get this error for all 9 test files find . -type f -iname ".*" -exec basename ; | rename 's/.//;' Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory
                      – Ortoch
                      Oct 1 '17 at 23:36




                      yes without the -n I get this error for all 9 test files find . -type f -iname ".*" -exec basename ; | rename 's/.//;' Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory Can't rename .test3 test3: No such file or directory Can't rename .test1 test1: No such file or directory Can't rename .test2 test2: No such file or directory
                      – Ortoch
                      Oct 1 '17 at 23:36












                      I am in TEST running this command on TEST/T1/.test1 TEST/T1/.test2 TEST/T1/.test3 etc....
                      – Ortoch
                      Oct 1 '17 at 23:37




                      I am in TEST running this command on TEST/T1/.test1 TEST/T1/.test2 TEST/T1/.test3 etc....
                      – Ortoch
                      Oct 1 '17 at 23:37










                      up vote
                      -1
                      down vote













                      find . -type f -name .* -exec rename -n 's/.//;' +





                      share|improve this answer




















                      • same error as the above solution Can't rename ./T2/.test3 /T2/.test3: No such file or directory almost looks like its trying to rename the Directory or something?
                        – Ortoch
                        Oct 1 '17 at 23:22






                      • 1




                        That's because rename gets to see files as ./path/foo.
                        – Satō Katsura
                        Oct 2 '17 at 3:25














                      up vote
                      -1
                      down vote













                      find . -type f -name .* -exec rename -n 's/.//;' +





                      share|improve this answer




















                      • same error as the above solution Can't rename ./T2/.test3 /T2/.test3: No such file or directory almost looks like its trying to rename the Directory or something?
                        – Ortoch
                        Oct 1 '17 at 23:22






                      • 1




                        That's because rename gets to see files as ./path/foo.
                        – Satō Katsura
                        Oct 2 '17 at 3:25












                      up vote
                      -1
                      down vote










                      up vote
                      -1
                      down vote









                      find . -type f -name .* -exec rename -n 's/.//;' +





                      share|improve this answer












                      find . -type f -name .* -exec rename -n 's/.//;' +






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Oct 1 '17 at 23:14









                      Hauke Laging

                      53.7k1282130




                      53.7k1282130











                      • same error as the above solution Can't rename ./T2/.test3 /T2/.test3: No such file or directory almost looks like its trying to rename the Directory or something?
                        – Ortoch
                        Oct 1 '17 at 23:22






                      • 1




                        That's because rename gets to see files as ./path/foo.
                        – Satō Katsura
                        Oct 2 '17 at 3:25
















                      • same error as the above solution Can't rename ./T2/.test3 /T2/.test3: No such file or directory almost looks like its trying to rename the Directory or something?
                        – Ortoch
                        Oct 1 '17 at 23:22






                      • 1




                        That's because rename gets to see files as ./path/foo.
                        – Satō Katsura
                        Oct 2 '17 at 3:25















                      same error as the above solution Can't rename ./T2/.test3 /T2/.test3: No such file or directory almost looks like its trying to rename the Directory or something?
                      – Ortoch
                      Oct 1 '17 at 23:22




                      same error as the above solution Can't rename ./T2/.test3 /T2/.test3: No such file or directory almost looks like its trying to rename the Directory or something?
                      – Ortoch
                      Oct 1 '17 at 23:22




                      1




                      1




                      That's because rename gets to see files as ./path/foo.
                      – Satō Katsura
                      Oct 2 '17 at 3:25




                      That's because rename gets to see files as ./path/foo.
                      – Satō Katsura
                      Oct 2 '17 at 3:25










                      up vote
                      -1
                      down vote













                      rename doesn't have a recursive option. If you want to rename the files in the current directory and all its subdirectories, put the following script in the parent directory and execute it.



                      #!/bin/bash
                      for i in `find . -name ".*"`
                      do
                      rename 's/.//' $i
                      done





                      share|improve this answer




















                      • Can't rename ./T2/.test3 /T2/.test3: No such file or directory got this error over and over in the test directory I'm playing with testing things out. Have 3 test directories with 3 test hidden files in each and all 9 files returned this string.
                        – Ortoch
                        Oct 1 '17 at 23:21











                      • I don't understand why that code sample shouldn't work, but just for reference: use $() instead of back ticks.
                        – ADDB
                        Oct 2 '17 at 17:42














                      up vote
                      -1
                      down vote













                      rename doesn't have a recursive option. If you want to rename the files in the current directory and all its subdirectories, put the following script in the parent directory and execute it.



                      #!/bin/bash
                      for i in `find . -name ".*"`
                      do
                      rename 's/.//' $i
                      done





                      share|improve this answer




















                      • Can't rename ./T2/.test3 /T2/.test3: No such file or directory got this error over and over in the test directory I'm playing with testing things out. Have 3 test directories with 3 test hidden files in each and all 9 files returned this string.
                        – Ortoch
                        Oct 1 '17 at 23:21











                      • I don't understand why that code sample shouldn't work, but just for reference: use $() instead of back ticks.
                        – ADDB
                        Oct 2 '17 at 17:42












                      up vote
                      -1
                      down vote










                      up vote
                      -1
                      down vote









                      rename doesn't have a recursive option. If you want to rename the files in the current directory and all its subdirectories, put the following script in the parent directory and execute it.



                      #!/bin/bash
                      for i in `find . -name ".*"`
                      do
                      rename 's/.//' $i
                      done





                      share|improve this answer












                      rename doesn't have a recursive option. If you want to rename the files in the current directory and all its subdirectories, put the following script in the parent directory and execute it.



                      #!/bin/bash
                      for i in `find . -name ".*"`
                      do
                      rename 's/.//' $i
                      done






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Oct 1 '17 at 23:17









                      Garnet

                      263




                      263











                      • Can't rename ./T2/.test3 /T2/.test3: No such file or directory got this error over and over in the test directory I'm playing with testing things out. Have 3 test directories with 3 test hidden files in each and all 9 files returned this string.
                        – Ortoch
                        Oct 1 '17 at 23:21











                      • I don't understand why that code sample shouldn't work, but just for reference: use $() instead of back ticks.
                        – ADDB
                        Oct 2 '17 at 17:42
















                      • Can't rename ./T2/.test3 /T2/.test3: No such file or directory got this error over and over in the test directory I'm playing with testing things out. Have 3 test directories with 3 test hidden files in each and all 9 files returned this string.
                        – Ortoch
                        Oct 1 '17 at 23:21











                      • I don't understand why that code sample shouldn't work, but just for reference: use $() instead of back ticks.
                        – ADDB
                        Oct 2 '17 at 17:42















                      Can't rename ./T2/.test3 /T2/.test3: No such file or directory got this error over and over in the test directory I'm playing with testing things out. Have 3 test directories with 3 test hidden files in each and all 9 files returned this string.
                      – Ortoch
                      Oct 1 '17 at 23:21





                      Can't rename ./T2/.test3 /T2/.test3: No such file or directory got this error over and over in the test directory I'm playing with testing things out. Have 3 test directories with 3 test hidden files in each and all 9 files returned this string.
                      – Ortoch
                      Oct 1 '17 at 23:21













                      I don't understand why that code sample shouldn't work, but just for reference: use $() instead of back ticks.
                      – ADDB
                      Oct 2 '17 at 17:42




                      I don't understand why that code sample shouldn't work, but just for reference: use $() instead of back ticks.
                      – ADDB
                      Oct 2 '17 at 17:42

















                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f395530%2funix-how-to-change-all-hidden-files-to-visible-in-a-multiple-sub-directories%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay