directory

Get full directory contents with AppleScript

◇◆丶佛笑我妖孽 提交于 2019-12-23 07:56:09
问题 I need to get the entire (visible) contents of a folder and its subfolders as a list. Is this possible? 回答1: I'm sure there is a shell command that can do this faster, but here is one way in pure Applescript that gives you total control over formatting what info you would like displayed. property kFileList : {} tell application "Finder" set source_folder to choose folder with prompt "Please select directory." my createList(source_folder) end tell on createList(item_list) set the the_items to

Applescript Copy file to a new folder

℡╲_俬逩灬. 提交于 2019-12-23 07:26:25
问题 I need to create an AppleSript that will copy specified files from one folder to a newly created folder. These files need to be specified in the AppleScript editor so something like: start fileToBeMoved = "Desktop/Test Folder 1/test.doc" newfoldername = "Test Folder 2" make newfolder and name it 'newfoldername' copy 'fileToBeMoved' to 'newfolder' end 回答1: Generally: tell application "Finder" make new folder at alias "Macintosh HD:Users:user:Desktop:" with properties {name:"Test Folder 2"}

Applescript Copy file to a new folder

寵の児 提交于 2019-12-23 07:25:14
问题 I need to create an AppleSript that will copy specified files from one folder to a newly created folder. These files need to be specified in the AppleScript editor so something like: start fileToBeMoved = "Desktop/Test Folder 1/test.doc" newfoldername = "Test Folder 2" make newfolder and name it 'newfoldername' copy 'fileToBeMoved' to 'newfolder' end 回答1: Generally: tell application "Finder" make new folder at alias "Macintosh HD:Users:user:Desktop:" with properties {name:"Test Folder 2"}

Case sensitive Directory.Exists / File.Exists

梦想与她 提交于 2019-12-23 07:16:16
问题 Is there a way to have a case sensitive Directory.Exists / File.Exists since Directory.Exists(folderPath) and Directory.Exists(folderPath.ToLower()) both return true ? Most of the time it doesn't matter but I'm using a macro which seems not to work if the path doesn't match cases 100%. 回答1: Since Directory.Exists uses FindFirstFile which is not case-sensitive, no. But you can PInvoke FindFirstFileEx with an additionalFlags parameter set to FIND_FIRST_EX_CASE_SENSITIVE 回答2: Based on the

get current directory of symlink'd php script and not actual php script

折月煮酒 提交于 2019-12-23 07:15:58
问题 I have a script that is symlinked from one folder to another /var/www/default/index.php which is symlinked to /var/www/mysite/index.php However when i call DIR from mysite the path resolves to the origial path under default. How do i make it return the mysite path (the symlinked folder, not the actual folder) 回答1: For Web Server requests dirname($_SERVER['SCRIPT_FILENAME']) will give you what you need. Failing that $_SERVER['PHP_SELF'] or even REQUEST_URI may have what you need, depending on

How do I create folders in ASP.NET in code behind?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 06:41:02
问题 I want to create dynamic folders at run time. Folder names with be input via a TextBox and output will be displayed in a TreeView. The form will submit if I enter the first folder name into textbox1 and click the "Add Folder" button. When I submit multiple folders with the same name the output should be an indexed increment of the name. Eg. FooFolder, FooFolder(2), FooFolder(3), etc. If I delete FooFolder(2) and then recreate a folder with the name FooFolder, the folder should be FooFolder(2)

How does bash script command substitution work?

半腔热情 提交于 2019-12-23 06:23:17
问题 And: "Why does this particular script have this outcome?" From Getting the source directory of a Bash script from within, based on some code snippets offered by user l0b0 in his comment on that question, I used the following for a cron job: DIR=$(pwd) if [ $CRON == "true" ]; then # If the environment variable $CRON is set to true, we're probably in a cron job if [ $PWD == "/" ]; then # And if the current working directory is root, we're probably in a cron job DIR="$( cd "$( dirname "${BASH

How does bash script command substitution work?

房东的猫 提交于 2019-12-23 06:22:06
问题 And: "Why does this particular script have this outcome?" From Getting the source directory of a Bash script from within, based on some code snippets offered by user l0b0 in his comment on that question, I used the following for a cron job: DIR=$(pwd) if [ $CRON == "true" ]; then # If the environment variable $CRON is set to true, we're probably in a cron job if [ $PWD == "/" ]; then # And if the current working directory is root, we're probably in a cron job DIR="$( cd "$( dirname "${BASH

Unable to make folders to zip files using java?

爷,独闯天下 提交于 2019-12-23 06:05:17
问题 Here i have folder(Books)structure inside of Books folder i have folders called physics,chemistry,science,english.I'm passing Books folder as zipDeleteFile but inside all folder has to convert in the same folder(Books)as physics.zip,chemistry.zip,science.zip,english.zip.But this code is not working. ' public void foldertToZip(File zipDeleteFile) { //System.out.println(zipDeleteFile); File directoryToZip = zipDeleteFile; List<File> fileList = new ArrayList<File>(); //System.out.println("--

Unable to make folders to zip files using java?

心已入冬 提交于 2019-12-23 06:03:05
问题 Here i have folder(Books)structure inside of Books folder i have folders called physics,chemistry,science,english.I'm passing Books folder as zipDeleteFile but inside all folder has to convert in the same folder(Books)as physics.zip,chemistry.zip,science.zip,english.zip.But this code is not working. ' public void foldertToZip(File zipDeleteFile) { //System.out.println(zipDeleteFile); File directoryToZip = zipDeleteFile; List<File> fileList = new ArrayList<File>(); //System.out.println("--