How to programmatically move, copy and delete files and directories on SD?

set the correct permissions in the manifest <uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” /> below is a function that will programmatically move your file private void moveFile(String inputPath, String inputFile, String outputPath) { InputStream in = null; OutputStream out = null; try { //create output directory if it doesn’t exist File dir = new File (outputPath); if (!dir.exists()) { … Read more

How to perform file system scanning

EDIT FOR 1.16: Enough people still hit this answer, that I thought I’d update it for Go 1.16. The function filepath.WalkDir introduced in Go 1.16 has better performance than filepath.Walk mentioned in the previous edit. Here’s a working example: package main import ( “flag” “fmt” “io/fs” “path/filepath” ) func visit(path string, di fs.DirEntry, err error) … Read more

How to filter files when using scp to copy dir recursively?

I’d probably recommend using something like rsync for this due to its include and exclude flags, e.g:- rsync -rav -e ssh –include ‘*/’ –include=”*.class” –exclude=”*” \ server:/usr/some/unknown/number/of/sub/folders/ \ /usr/project/backup/some/unknown/number/of/sub/folders/ Some other useful flags: -r for recursive -a for archive (mostly all files) -v for verbose output -e to specify ssh instead of the default (which … Read more

How to find the largest file in a directory and its subdirectories?

Quote from this link- If you want to find and print the top 10 largest files names (not directories) in a particular directory and its sub directories $ find . -type f -printf ‘%s %p\n’|sort -nr|head To restrict the search to the present directory use “-maxdepth 1” with find. $ find . -maxdepth 1 -printf … Read more

How to rename a virtualenv in Python?

By default virtualenv does not support the renaming of environments. It is safer to just delete the virtualenv directory and create a new one with the correct name. You can do this by: Activate your virtualenv: source vnev/bin/activate Create a requirements.txt of currently installed packages: pip freeze > requirements.txt Delete the misspelled virtualenv: rm -r … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)