Issue
I’m trying to upload a bunch of .7z files to my Server where my customers can get automatic download links. Once I upload the .7z files, I need to copy/paste the last file extension in a .txt editor and parse it with my website’s custom URL. It’s something like this:
{.7z Files}
001187238.7z
009181905.7z
{Server/Link Folder}
https://website/s1/2291817181/918291918/
https://website/s1/8817530194/114532001/
{Download Links / Finished Process}
https://website/s1/2291817181/918291918/009181905.7z
https://website/s1/8817530194/114532001/001187238.7z
Is there any way where I can run
dir /B %userprofile%\Desktop\folder > --foldernames--.txt
and maybe combine it with a fixed string/link:
https://website/s1/2291817181/918291918/
So, that in the end I get a link + the folder name combined, and saved inside the .txt file?
Thank you!
Solution
I’m struggling to understand what you want from your description (especially, how to determine, which file should be connected to which folder), but to answer the question itself:
@echo off
(for /f "delims=" %%a in ('dir /B %userprofile%\Desktop\folder\*.7z') do (
echo https://website/s1/2291817181/918291918/%%a
)) > --foldernames--.txt
Answered By – Stephan
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0