Tag: folder

Microsoft Windows

How to delete a folder in use

1. Start Process Explorer from SysInternals suite. 2. Press Ctrl+F to open Search window. 3. Search for the folder name that you want to delete but it’s in use. 4. Kill all the processes that use this folder. 5. Delete the folder. https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx https://technet.microsoft.com/en-us/sysinternals/bb842062

Java

Check if file or directory exists in Java

Check if file exists: File f = new File("/path/to/filename"); if(f.exists()){ .. }File f = new File("/path/to/filename"); if(f.exists()){ .. } Check if directory exists: File f = new File("/path/to/folder/"); if(f.exists() && f.isDirectory()){ .. }File f = new File("/path/to/folder/"); if(f.exists() && f.isDirectory()){ .. }

Python

Create images thumbnails with Python

import glob import Image dir="/home/username/Pictures/"   for infile in glob.glob(dir+"*.jpg"): imgfile=infile[(infile.rfind("/")+1):] if infile[0:2] == "thumb_": continue try: img = Image.open(infile) img.thumbnail((128, 128), Image.ANTIALIAS) img.save(dir + "thumb_" + imgfile, "JPEG") except IOError: img=Noneimport glob import Image dir="/home/username/Pictures/" for infile in glob.glob(dir+"*.jpg"): imgfile=infile[(infile.rfind("/")+1):] if infile[0:2] == "thumb_": continue try: img = Image.open(infile) img.thumbnail((128, 128), Image.ANTIALIAS) img.save(dir + …