Creating empty copies of files with new extensions












1















I have AIX 7.1. Let's say I have a directory with files like these:



1.txt
lala.csv


I need to create empty copies of these files with a new extension in the same directory, like so:



1.txt.done
lala.csv.done


I can't seem to find the right option for doing this.










share|improve this question





























    1















    I have AIX 7.1. Let's say I have a directory with files like these:



    1.txt
    lala.csv


    I need to create empty copies of these files with a new extension in the same directory, like so:



    1.txt.done
    lala.csv.done


    I can't seem to find the right option for doing this.










    share|improve this question



























      1












      1








      1








      I have AIX 7.1. Let's say I have a directory with files like these:



      1.txt
      lala.csv


      I need to create empty copies of these files with a new extension in the same directory, like so:



      1.txt.done
      lala.csv.done


      I can't seem to find the right option for doing this.










      share|improve this question
















      I have AIX 7.1. Let's say I have a directory with files like these:



      1.txt
      lala.csv


      I need to create empty copies of these files with a new extension in the same directory, like so:



      1.txt.done
      lala.csv.done


      I can't seem to find the right option for doing this.







      files filenames aix






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 6 at 21:44









      Rui F Ribeiro

      39.5k1479132




      39.5k1479132










      asked Oct 1 '18 at 12:11









      xaren joxaren jo

      62




      62






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Simply loop over every file (here, skipping dotfiles by default), and touch the corresponding file:



          for f in *; do touch "${f}.done"; done





          share|improve this answer
























          • could you also clarify what does $ do in this command?

            – xaren jo
            Oct 1 '18 at 13:32











          • Sure, @xarenjo ; it introduces a variable expansion. I used curly braces out of habit, to explicitly delineate what the variable is (f). The end result is that the touch command sees the value of $f — each existing filename — during each loop.

            – Jeff Schaller
            Oct 1 '18 at 13:36











          • Or with redirection : for f in *; do > "${f}.done"; done

            – ctac_
            Oct 1 '18 at 14:39











          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          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%2f472564%2fcreating-empty-copies-of-files-with-new-extensions%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          Simply loop over every file (here, skipping dotfiles by default), and touch the corresponding file:



          for f in *; do touch "${f}.done"; done





          share|improve this answer
























          • could you also clarify what does $ do in this command?

            – xaren jo
            Oct 1 '18 at 13:32











          • Sure, @xarenjo ; it introduces a variable expansion. I used curly braces out of habit, to explicitly delineate what the variable is (f). The end result is that the touch command sees the value of $f — each existing filename — during each loop.

            – Jeff Schaller
            Oct 1 '18 at 13:36











          • Or with redirection : for f in *; do > "${f}.done"; done

            – ctac_
            Oct 1 '18 at 14:39
















          2














          Simply loop over every file (here, skipping dotfiles by default), and touch the corresponding file:



          for f in *; do touch "${f}.done"; done





          share|improve this answer
























          • could you also clarify what does $ do in this command?

            – xaren jo
            Oct 1 '18 at 13:32











          • Sure, @xarenjo ; it introduces a variable expansion. I used curly braces out of habit, to explicitly delineate what the variable is (f). The end result is that the touch command sees the value of $f — each existing filename — during each loop.

            – Jeff Schaller
            Oct 1 '18 at 13:36











          • Or with redirection : for f in *; do > "${f}.done"; done

            – ctac_
            Oct 1 '18 at 14:39














          2












          2








          2







          Simply loop over every file (here, skipping dotfiles by default), and touch the corresponding file:



          for f in *; do touch "${f}.done"; done





          share|improve this answer













          Simply loop over every file (here, skipping dotfiles by default), and touch the corresponding file:



          for f in *; do touch "${f}.done"; done






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 1 '18 at 12:21









          Jeff SchallerJeff Schaller

          39.3k1054125




          39.3k1054125













          • could you also clarify what does $ do in this command?

            – xaren jo
            Oct 1 '18 at 13:32











          • Sure, @xarenjo ; it introduces a variable expansion. I used curly braces out of habit, to explicitly delineate what the variable is (f). The end result is that the touch command sees the value of $f — each existing filename — during each loop.

            – Jeff Schaller
            Oct 1 '18 at 13:36











          • Or with redirection : for f in *; do > "${f}.done"; done

            – ctac_
            Oct 1 '18 at 14:39



















          • could you also clarify what does $ do in this command?

            – xaren jo
            Oct 1 '18 at 13:32











          • Sure, @xarenjo ; it introduces a variable expansion. I used curly braces out of habit, to explicitly delineate what the variable is (f). The end result is that the touch command sees the value of $f — each existing filename — during each loop.

            – Jeff Schaller
            Oct 1 '18 at 13:36











          • Or with redirection : for f in *; do > "${f}.done"; done

            – ctac_
            Oct 1 '18 at 14:39

















          could you also clarify what does $ do in this command?

          – xaren jo
          Oct 1 '18 at 13:32





          could you also clarify what does $ do in this command?

          – xaren jo
          Oct 1 '18 at 13:32













          Sure, @xarenjo ; it introduces a variable expansion. I used curly braces out of habit, to explicitly delineate what the variable is (f). The end result is that the touch command sees the value of $f — each existing filename — during each loop.

          – Jeff Schaller
          Oct 1 '18 at 13:36





          Sure, @xarenjo ; it introduces a variable expansion. I used curly braces out of habit, to explicitly delineate what the variable is (f). The end result is that the touch command sees the value of $f — each existing filename — during each loop.

          – Jeff Schaller
          Oct 1 '18 at 13:36













          Or with redirection : for f in *; do > "${f}.done"; done

          – ctac_
          Oct 1 '18 at 14:39





          Or with redirection : for f in *; do > "${f}.done"; done

          – ctac_
          Oct 1 '18 at 14:39


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f472564%2fcreating-empty-copies-of-files-with-new-extensions%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Morgemoulin

          Scott Moir

          Souastre