Recursive os.listdir? [duplicate]
import os [os.path.join(dp, f) for dp, dn, fn in os.walk(os.path.expanduser(“~/files”)) for f in fn]
import os [os.path.join(dp, f) for dp, dn, fn in os.walk(os.path.expanduser(“~/files”)) for f in fn]
You can do what you are describing like this: Move the content of ABC to an ABC/ subdirectory, and fix the history so that it looks like it has always been there: $ cd /path/to/ABC $ git filter-branch –index-filter \ ‘git ls-files -s | sed “s-\t-&ABC/-” | GIT_INDEX_FILE=$GIT_INDEX_FILE.new \ git update-index –index-info && mv $GIT_INDEX_FILE.new … Read more
This finds all non-text based, binary, and empty files. Edit Solution with only grep (from Mehrdad’s comment): grep -rIL . Original answer This does not require any other tool except find and grep: find . -type f -exec grep -IL . “{}” \; -I tells grep to assume binary files as unmatched -L prints only … Read more
To check if a folder contains at least one file >nul 2>nul dir /a-d “folderName\*” && (echo Files exist) || (echo No file found) To check if a folder or any of its descendents contain at least one file >nul 2>nul dir /a-d /s “folderName\*” && (echo Files exist) || (echo No file found) To … Read more
chmod can actually do this itself; the X symbolic permission means “execute, if it makes sense” which generally means on directories but not files. So, you can use: chmod -R u=rwX,go=rX /path/to/htdocs The only potential problem is that if any of the plain files already have execute set, chmod assumes it’s intentional and keeps it. … Read more
Use System.IO.Directory.CreateDirectory Addtional note: You don’t have to check if it exists first. CreateDirectory will do the right thing regardless.
Do it like this : String folder_main = “NewFolder”; File f = new File(Environment.getExternalStorageDirectory(), folder_main); if (!f.exists()) { f.mkdirs(); } If you wanna create another folder into that : File f1 = new File(Environment.getExternalStorageDirectory() + “https://stackoverflow.com/” + folder_main, “product1”); if (!f1.exists()) { f1.mkdirs(); }