I also need files with content and empty ones.
Why not, what happened? I only copied that code from the code you posted. If one worked and the other did not, is it a permissions problem?
Generic code only creates a folder, I need files too. until i got this success, here is the code that works
mkdir img
mcdeer js
mcdeer css
What should mcdeer be? Never heard of this command
this command creates folders in bat file.
batch files donât contain folders.
You can create a file with
echo Hello>new.txt
This will create a file named new.txt containing the text Hello
.
Yes, it works universally, thatâs good, but now how to make sure that files are created in the styles and javascript folders?
What exactly happens when you try to create files in those particular folders? Are you trying to do this from a web site, or from a command line / file explorer? Is it a permissions problem?
They are not created, I myself want to create files in certain folders, I donât know how to write the code for this correctly)
You can use a relative path for the file.
echo >\css\style.php, if yes then it doesnât work
You havenât said whether youâre doing this in Windows or Linux and you havenât told us your file structure, so itâs very difficult to second-guess what you are trying to do.
Iâm doing this on Windows, the structure should look like this: css folder â styles.css file, javascript folder â js.js file
Then you probably want to be using a slash rather than a backslash, and if you want to create something in a subdirectory you donât want the leading slash (thatâs trying to create a file in the root directory).
echo >/css/style.php it doesnât work.
Thatâs going to try to create a style.css file in the root directory as I said in my last post.
Edit: What I should have said is it will create a styles.css file in a subdirectory (named css) of the root directory.
at the root, it creates if the code is created like this echo > styles.css, and I need it in the css folder
Where is the css folder in relation to your bat folder as mentioned in post #15 ? Above it, below it, somewhere else entirely?
This is not doing exactly what you want but it should be enough for you to be able to modify for your exact needs.
rem Create 2 subdirectories
mkdir css
mkdir js
rem Create a file in each (sub)directory
type NUL > index.html
type NUL > js/script.js
echo /* styles.css */ > css/styles.css
rem Finished!
The css folder is in the bat folder