batch code not working when put inside a loop












0














This code works and picks a random file but when I put it inside the outer loop, I get empty "" instead.



rem scrambler
setlocal EnableDelayedExpansion

@echo off
cd j:target

rem for /R %%t in (*.mp3) do (

REM echo ********************
REM echo T folder is %%~dpt

cd j:source
set n=0
for /R %%f in (*.mp3) do (

set /A n+=1
set "file[!n!]=%%f"
)
set /A "rand=(n*%random%)/32768+1"
rem copy "!file[%rand%]!" j:target

echo "!file[%rand%]!"
cd j:target
REM copy "!file[%rand%]!" %%~dpt
REM move "!file[%rand%]!" j:old
rem )


PS. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.










share|improve this question









New contributor




vtastek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    Shouldn't those %rand% be !rand! in stead? And can you run it with ECHO ON to see exactly when the error message happens? Your statement 'I get empty ""' instead' isn't very clear about where in the loop(s) that happens.
    – Tonny
    Jan 6 at 12:37










  • I tried that, the result is now just rand as a string. It is working with the code above already, printing the random file name. Thanks for the ECHO ON tip. The error is echo "!file[%rand%]!" here. If you enable the outer loop rem for /R %%t in (*.mp3) do (, you can see it. I suspect the EnableDelayedExpansion part, I should put it somewhere else I guess.
    – vtastek
    Jan 6 at 13:12


















0














This code works and picks a random file but when I put it inside the outer loop, I get empty "" instead.



rem scrambler
setlocal EnableDelayedExpansion

@echo off
cd j:target

rem for /R %%t in (*.mp3) do (

REM echo ********************
REM echo T folder is %%~dpt

cd j:source
set n=0
for /R %%f in (*.mp3) do (

set /A n+=1
set "file[!n!]=%%f"
)
set /A "rand=(n*%random%)/32768+1"
rem copy "!file[%rand%]!" j:target

echo "!file[%rand%]!"
cd j:target
REM copy "!file[%rand%]!" %%~dpt
REM move "!file[%rand%]!" j:old
rem )


PS. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.










share|improve this question









New contributor




vtastek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    Shouldn't those %rand% be !rand! in stead? And can you run it with ECHO ON to see exactly when the error message happens? Your statement 'I get empty ""' instead' isn't very clear about where in the loop(s) that happens.
    – Tonny
    Jan 6 at 12:37










  • I tried that, the result is now just rand as a string. It is working with the code above already, printing the random file name. Thanks for the ECHO ON tip. The error is echo "!file[%rand%]!" here. If you enable the outer loop rem for /R %%t in (*.mp3) do (, you can see it. I suspect the EnableDelayedExpansion part, I should put it somewhere else I guess.
    – vtastek
    Jan 6 at 13:12
















0












0








0







This code works and picks a random file but when I put it inside the outer loop, I get empty "" instead.



rem scrambler
setlocal EnableDelayedExpansion

@echo off
cd j:target

rem for /R %%t in (*.mp3) do (

REM echo ********************
REM echo T folder is %%~dpt

cd j:source
set n=0
for /R %%f in (*.mp3) do (

set /A n+=1
set "file[!n!]=%%f"
)
set /A "rand=(n*%random%)/32768+1"
rem copy "!file[%rand%]!" j:target

echo "!file[%rand%]!"
cd j:target
REM copy "!file[%rand%]!" %%~dpt
REM move "!file[%rand%]!" j:old
rem )


PS. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.










share|improve this question









New contributor




vtastek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











This code works and picks a random file but when I put it inside the outer loop, I get empty "" instead.



rem scrambler
setlocal EnableDelayedExpansion

@echo off
cd j:target

rem for /R %%t in (*.mp3) do (

REM echo ********************
REM echo T folder is %%~dpt

cd j:source
set n=0
for /R %%f in (*.mp3) do (

set /A n+=1
set "file[!n!]=%%f"
)
set /A "rand=(n*%random%)/32768+1"
rem copy "!file[%rand%]!" j:target

echo "!file[%rand%]!"
cd j:target
REM copy "!file[%rand%]!" %%~dpt
REM move "!file[%rand%]!" j:old
rem )


PS. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.







windows command-line batch-file






share|improve this question









New contributor




vtastek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




vtastek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Jan 6 at 18:39







vtastek













New contributor




vtastek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Jan 6 at 12:21









vtastekvtastek

33




33




New contributor




vtastek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





vtastek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






vtastek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 2




    Shouldn't those %rand% be !rand! in stead? And can you run it with ECHO ON to see exactly when the error message happens? Your statement 'I get empty ""' instead' isn't very clear about where in the loop(s) that happens.
    – Tonny
    Jan 6 at 12:37










  • I tried that, the result is now just rand as a string. It is working with the code above already, printing the random file name. Thanks for the ECHO ON tip. The error is echo "!file[%rand%]!" here. If you enable the outer loop rem for /R %%t in (*.mp3) do (, you can see it. I suspect the EnableDelayedExpansion part, I should put it somewhere else I guess.
    – vtastek
    Jan 6 at 13:12
















  • 2




    Shouldn't those %rand% be !rand! in stead? And can you run it with ECHO ON to see exactly when the error message happens? Your statement 'I get empty ""' instead' isn't very clear about where in the loop(s) that happens.
    – Tonny
    Jan 6 at 12:37










  • I tried that, the result is now just rand as a string. It is working with the code above already, printing the random file name. Thanks for the ECHO ON tip. The error is echo "!file[%rand%]!" here. If you enable the outer loop rem for /R %%t in (*.mp3) do (, you can see it. I suspect the EnableDelayedExpansion part, I should put it somewhere else I guess.
    – vtastek
    Jan 6 at 13:12










2




2




Shouldn't those %rand% be !rand! in stead? And can you run it with ECHO ON to see exactly when the error message happens? Your statement 'I get empty ""' instead' isn't very clear about where in the loop(s) that happens.
– Tonny
Jan 6 at 12:37




Shouldn't those %rand% be !rand! in stead? And can you run it with ECHO ON to see exactly when the error message happens? Your statement 'I get empty ""' instead' isn't very clear about where in the loop(s) that happens.
– Tonny
Jan 6 at 12:37












I tried that, the result is now just rand as a string. It is working with the code above already, printing the random file name. Thanks for the ECHO ON tip. The error is echo "!file[%rand%]!" here. If you enable the outer loop rem for /R %%t in (*.mp3) do (, you can see it. I suspect the EnableDelayedExpansion part, I should put it somewhere else I guess.
– vtastek
Jan 6 at 13:12






I tried that, the result is now just rand as a string. It is working with the code above already, printing the random file name. Thanks for the ECHO ON tip. The error is echo "!file[%rand%]!" here. If you enable the outer loop rem for /R %%t in (*.mp3) do (, you can see it. I suspect the EnableDelayedExpansion part, I should put it somewhere else I guess.
– vtastek
Jan 6 at 13:12












1 Answer
1






active

oldest

votes


















0














There are several flaws within your code




  1. with nested for loops you'd need two levels of delayed expansion (what is possible)

  2. For every iteration of the outer for /r you rebuild/overwrite the very same file array from source files.

  3. if you build the array first there is no need to constantly switch between source and target (the folder is stored in the array anyway)

  4. despite the name scrambler it's unclear what you want to achieve with two copy and one move, please elaborate.




:: Q:Test201916SU_1391138.cmd
rem scrambler
@echo off
setlocal EnableDelayedExpansion

cd j:source

set n=0
for /R %%f in (*.mp3) do (
set /A n+=1
set "file[!n!]=%%f"
)

cd j:target
for /R %%t in (*.mp3) do (
set /A "rand=(n*!random!)/32768+1,m=n,n-=1"

rem following line demonstrates double delayedexpansion with a pseudo call
call set "file=%%file[!rand!]%%"
call set "file[!rand!]=%%file[!m!]%%"

echo copy /B /Y "!file!" "%%t"
copy /B /Y "!file!" "%%t"
)





share|improve this answer























  • Thanks for the answer, I will try it and see how it goes. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.
    – vtastek
    Jan 6 at 18:04










  • Better edit your question to contain that explanation. Are the number of files in source and target identical? You could then use only the array, replace the file[random] entry with the last one file[n] and decrement n.
    – LotPings
    Jan 6 at 18:26










  • Done. Yes they are identical. There are wav files too but they shouldn't interfere. Thanks again for the tip.
    – vtastek
    Jan 6 at 18:44










  • Try changed (and untested) answer, may already do what you want.
    – LotPings
    Jan 6 at 18:45










  • Thank you very much. It is working, I can even rerun it which is a good feature.
    – vtastek
    Jan 6 at 18:58











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
});


}
});






vtastek is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1391138%2fbatch-code-not-working-when-put-inside-a-loop%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









0














There are several flaws within your code




  1. with nested for loops you'd need two levels of delayed expansion (what is possible)

  2. For every iteration of the outer for /r you rebuild/overwrite the very same file array from source files.

  3. if you build the array first there is no need to constantly switch between source and target (the folder is stored in the array anyway)

  4. despite the name scrambler it's unclear what you want to achieve with two copy and one move, please elaborate.




:: Q:Test201916SU_1391138.cmd
rem scrambler
@echo off
setlocal EnableDelayedExpansion

cd j:source

set n=0
for /R %%f in (*.mp3) do (
set /A n+=1
set "file[!n!]=%%f"
)

cd j:target
for /R %%t in (*.mp3) do (
set /A "rand=(n*!random!)/32768+1,m=n,n-=1"

rem following line demonstrates double delayedexpansion with a pseudo call
call set "file=%%file[!rand!]%%"
call set "file[!rand!]=%%file[!m!]%%"

echo copy /B /Y "!file!" "%%t"
copy /B /Y "!file!" "%%t"
)





share|improve this answer























  • Thanks for the answer, I will try it and see how it goes. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.
    – vtastek
    Jan 6 at 18:04










  • Better edit your question to contain that explanation. Are the number of files in source and target identical? You could then use only the array, replace the file[random] entry with the last one file[n] and decrement n.
    – LotPings
    Jan 6 at 18:26










  • Done. Yes they are identical. There are wav files too but they shouldn't interfere. Thanks again for the tip.
    – vtastek
    Jan 6 at 18:44










  • Try changed (and untested) answer, may already do what you want.
    – LotPings
    Jan 6 at 18:45










  • Thank you very much. It is working, I can even rerun it which is a good feature.
    – vtastek
    Jan 6 at 18:58
















0














There are several flaws within your code




  1. with nested for loops you'd need two levels of delayed expansion (what is possible)

  2. For every iteration of the outer for /r you rebuild/overwrite the very same file array from source files.

  3. if you build the array first there is no need to constantly switch between source and target (the folder is stored in the array anyway)

  4. despite the name scrambler it's unclear what you want to achieve with two copy and one move, please elaborate.




:: Q:Test201916SU_1391138.cmd
rem scrambler
@echo off
setlocal EnableDelayedExpansion

cd j:source

set n=0
for /R %%f in (*.mp3) do (
set /A n+=1
set "file[!n!]=%%f"
)

cd j:target
for /R %%t in (*.mp3) do (
set /A "rand=(n*!random!)/32768+1,m=n,n-=1"

rem following line demonstrates double delayedexpansion with a pseudo call
call set "file=%%file[!rand!]%%"
call set "file[!rand!]=%%file[!m!]%%"

echo copy /B /Y "!file!" "%%t"
copy /B /Y "!file!" "%%t"
)





share|improve this answer























  • Thanks for the answer, I will try it and see how it goes. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.
    – vtastek
    Jan 6 at 18:04










  • Better edit your question to contain that explanation. Are the number of files in source and target identical? You could then use only the array, replace the file[random] entry with the last one file[n] and decrement n.
    – LotPings
    Jan 6 at 18:26










  • Done. Yes they are identical. There are wav files too but they shouldn't interfere. Thanks again for the tip.
    – vtastek
    Jan 6 at 18:44










  • Try changed (and untested) answer, may already do what you want.
    – LotPings
    Jan 6 at 18:45










  • Thank you very much. It is working, I can even rerun it which is a good feature.
    – vtastek
    Jan 6 at 18:58














0












0








0






There are several flaws within your code




  1. with nested for loops you'd need two levels of delayed expansion (what is possible)

  2. For every iteration of the outer for /r you rebuild/overwrite the very same file array from source files.

  3. if you build the array first there is no need to constantly switch between source and target (the folder is stored in the array anyway)

  4. despite the name scrambler it's unclear what you want to achieve with two copy and one move, please elaborate.




:: Q:Test201916SU_1391138.cmd
rem scrambler
@echo off
setlocal EnableDelayedExpansion

cd j:source

set n=0
for /R %%f in (*.mp3) do (
set /A n+=1
set "file[!n!]=%%f"
)

cd j:target
for /R %%t in (*.mp3) do (
set /A "rand=(n*!random!)/32768+1,m=n,n-=1"

rem following line demonstrates double delayedexpansion with a pseudo call
call set "file=%%file[!rand!]%%"
call set "file[!rand!]=%%file[!m!]%%"

echo copy /B /Y "!file!" "%%t"
copy /B /Y "!file!" "%%t"
)





share|improve this answer














There are several flaws within your code




  1. with nested for loops you'd need two levels of delayed expansion (what is possible)

  2. For every iteration of the outer for /r you rebuild/overwrite the very same file array from source files.

  3. if you build the array first there is no need to constantly switch between source and target (the folder is stored in the array anyway)

  4. despite the name scrambler it's unclear what you want to achieve with two copy and one move, please elaborate.




:: Q:Test201916SU_1391138.cmd
rem scrambler
@echo off
setlocal EnableDelayedExpansion

cd j:source

set n=0
for /R %%f in (*.mp3) do (
set /A n+=1
set "file[!n!]=%%f"
)

cd j:target
for /R %%t in (*.mp3) do (
set /A "rand=(n*!random!)/32768+1,m=n,n-=1"

rem following line demonstrates double delayedexpansion with a pseudo call
call set "file=%%file[!rand!]%%"
call set "file[!rand!]=%%file[!m!]%%"

echo copy /B /Y "!file!" "%%t"
copy /B /Y "!file!" "%%t"
)






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 6 at 18:44

























answered Jan 6 at 17:41









LotPingsLotPings

4,7061722




4,7061722












  • Thanks for the answer, I will try it and see how it goes. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.
    – vtastek
    Jan 6 at 18:04










  • Better edit your question to contain that explanation. Are the number of files in source and target identical? You could then use only the array, replace the file[random] entry with the last one file[n] and decrement n.
    – LotPings
    Jan 6 at 18:26










  • Done. Yes they are identical. There are wav files too but they shouldn't interfere. Thanks again for the tip.
    – vtastek
    Jan 6 at 18:44










  • Try changed (and untested) answer, may already do what you want.
    – LotPings
    Jan 6 at 18:45










  • Thank you very much. It is working, I can even rerun it which is a good feature.
    – vtastek
    Jan 6 at 18:58


















  • Thanks for the answer, I will try it and see how it goes. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.
    – vtastek
    Jan 6 at 18:04










  • Better edit your question to contain that explanation. Are the number of files in source and target identical? You could then use only the array, replace the file[random] entry with the last one file[n] and decrement n.
    – LotPings
    Jan 6 at 18:26










  • Done. Yes they are identical. There are wav files too but they shouldn't interfere. Thanks again for the tip.
    – vtastek
    Jan 6 at 18:44










  • Try changed (and untested) answer, may already do what you want.
    – LotPings
    Jan 6 at 18:45










  • Thank you very much. It is working, I can even rerun it which is a good feature.
    – vtastek
    Jan 6 at 18:58
















Thanks for the answer, I will try it and see how it goes. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.
– vtastek
Jan 6 at 18:04




Thanks for the answer, I will try it and see how it goes. What I am trying to do is: identical source and target folders with mp3 files in them. Then I loop through the target files and for each target file, I overwrite them with a random mp3 file from the source folder. I (re)move the file from source and randomly pick another source file for the next target file, so I exhaust all files without any duplicates. In the end the target has same files and structure as source but they are now scrambled, that is if I can achieve it. I know the array takes some time so I want to optimize it too.
– vtastek
Jan 6 at 18:04












Better edit your question to contain that explanation. Are the number of files in source and target identical? You could then use only the array, replace the file[random] entry with the last one file[n] and decrement n.
– LotPings
Jan 6 at 18:26




Better edit your question to contain that explanation. Are the number of files in source and target identical? You could then use only the array, replace the file[random] entry with the last one file[n] and decrement n.
– LotPings
Jan 6 at 18:26












Done. Yes they are identical. There are wav files too but they shouldn't interfere. Thanks again for the tip.
– vtastek
Jan 6 at 18:44




Done. Yes they are identical. There are wav files too but they shouldn't interfere. Thanks again for the tip.
– vtastek
Jan 6 at 18:44












Try changed (and untested) answer, may already do what you want.
– LotPings
Jan 6 at 18:45




Try changed (and untested) answer, may already do what you want.
– LotPings
Jan 6 at 18:45












Thank you very much. It is working, I can even rerun it which is a good feature.
– vtastek
Jan 6 at 18:58




Thank you very much. It is working, I can even rerun it which is a good feature.
– vtastek
Jan 6 at 18:58










vtastek is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















vtastek is a new contributor. Be nice, and check out our Code of Conduct.













vtastek is a new contributor. Be nice, and check out our Code of Conduct.












vtastek is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Super User!


  • 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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2fsuperuser.com%2fquestions%2f1391138%2fbatch-code-not-working-when-put-inside-a-loop%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

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?