FAQ Database Discussion Community


How can I use os.walk or any other alternative to traverse folders recursively by the natural name order?

python,folder
In python if I iterate all the folders by os.walk recursievely to find any filr with the defined extension. this is my present code; def get_data_paths(root_path, ext = '*.jpg'): import os import fnmatch matches = [] classes = [] class_names = [] for root, dirnames, filenames in os.walk(root_path): for filename...

Execute Windows Explorer to copy/move/delete file from VB.NET app

vb.net,file,folder,explorer
I notice 7zip and WinRAR that after it extracts from an archive, it executes Windows Explorer to move the files from the temp directory to the desired folder. Are they using command lines as they execute it (probably yes)? I will be using copy, move, and delete a file/folder using...

Rails: Include Javascript_include_tag outside default folders

javascript,ruby-on-rails,templates,folder
I have a template that I'm trying to include on my Rails Aplication. This template has it's own structure that I don't want to mess with. Lets call this template "material". I've put all the files under my vendor/assets folder, so that I have this structure: railsApp/vendor/assets/material/material Inside this last...

Get all items of a sharepoint list

c#,sharepoint,folder,subfolder,client-object-model
i want to download all files of my sharepoint list. I download the files with this method: public void DownloadFilesOfSpecialtys( ) { using (var clientContext = new ClientContext(url)) { foreach (var item in ids) { int listItemId = int.Parse(item.ToString()); statics.files = int.Parse(ids.Count.ToString()); var list = clientContext.Web.Lists.GetByTitle(listtitle); var listItem = list.GetItemById(listItemId);...

VBA fails to limit to just .dat files if there are zip files present in the folder

vba,filter,folder,zipfile
I have added a filter to the type of files allowed to selected (.dat files) however I have found that if there are zip files present in the folder the script does not work correctly as it also opens the zip files. 'Specify folder where measurement files are stored With...

Are stringified MongoDB ObjectID's safe as folder names?

ruby,mongodb,folder,objectid
As it says on the tin. I'd like to name folders corresponding to "Channels." I'd personally rather use the human-readable name but I was told halfway through development that names cannot be static (for some reason)

How to copy using scp on shell script to folders space named?

shell,folder,scp
Hey guys I am working on this app that connects to Raspberry Pi through SSH. I use NSTask and NSPipe and shell scripts to execute the shell commands through the Mac app GUI. The problem is that when I want to copy using "scp" command I get "No such file...

How to Set Permission for folders/files in iOS

ios,permissions,folder
How can I set permission to folders and files in iOS which is there inside documents folder? Is it possible to set read only permission while creating files inside documents folder? Or any alternative solution ?...

Is there a way to find the home screen directory? [closed]

java,android,path,folder,home
My Question may be stupid but let's say how can I get the path of a folder in the home screen My problem is that I can't think of away to get the path of a folder in the home screen. Let's say i have a folder with some applications...

Only conserve the name of the folder in a .txt file with a complete directory (Batch)

windows,batch-file,directory,folder,rename
(I DIDN'T DO A BATCH WITH THIS STUFF YET) I have a file called "worldcopy2.txt" which inside has a full directory: C:\Users\Robert\Desktop\myworld2 And I want to create a batch file to change the inside of the .txt to only have the name of the last folder of the directory that...

Increment per File

java,file,folder,increment
Below is some of my code. I am going through a folder, pulling every image, and finding the RGB value of every pixel, and determining which ones are blue. I am trying to only increment per file, but for some reason, it is continuing and adding every file's increment. try...

Android check if file exists() not work

android,database,file,folder
I'm checking if the database in a folder of the device exists. The folder and the database exists, but is not found. The path is right, then where am I wrong? private void checkDBexists(){ File internal = Environment.getExternalStorageDirectory(); File myFile = new File(internal.getAbsoluteFile()+"MyFolder/database.db"); if(myFile.exists()){ importaDB(); }else{ Toast toast = Toast.makeText(getActivity().getApplicationContext(),...

PHP rename and concatenation adds extra numbers

php,loops,folder,rename
I have the following code which operates as follows: option 1 renames the files in a folder with a random string option 2 renames the files in an incremental manner. The issue is for some reason the loop runs twice, leaving me with numbers starting from greater than 0. Can...

Where the following code creating forlder [duplicate]

android,file,folder
This question already has an answer here: getExternalStorageDirectory not working 7 answers kindly guide me where the following code is creating folder? i didnt find it. and i also wanted to know about this function [getExternalStorageDirectory()] that what location it returns in sd card? MY_IMG_DIR = new File( Environment.getExternalStorageDirectory(),...

How To Create A Folder In C# Without Usernames and Drive Partition Affecting It

c#,folder,username,partition
While creating a folder / file is really easy, just last night I decided to test my application on a different computer. In that application I do create a specific directory. As I expected on the different computer it didn't quite work. A file path in windows looks like this...

Group items based on x number characters of basename

powershell,folder
I got help to setup a clever script that groups items in a folder based on basename and LastWriteTime it lets me delete everything except given number of files (i.e 5 versions). Now I'd like to limit basename grouping to 8 characters. gci C:\test\ | where{-not $_.PsIsContainer} | $file =...

how to download a folder from bash?

download,folder
I want to download a complete folder from a jenkins project containing many folder I try with a wget and it works for only one file doing : wget http://jenkinsmedia:XXXX/job/Lib//280/artifact/tool.rpm but in the same place there is tool.rpm, there is a folder Test I want to download the whole folder,...

Create ISO image from folder

osx,folder,iso
I wrote a script which creates and ISO image from a folder, but when the folder contains spaces, I get an error message. Can somebody please help me? I'm working with Mac OSX Mavericks and Terminal. Thanks in advance. Script: #!/bin/sh cd /Volumes/Daten/fake for i in ./*; do hdiutil makehybrid...

pathForDirectory method for NSBundle?

ios,path,directory,folder,nsbundle
If I include a folder in my bundle (a real folder, the blue ones, not the yellow groups), how can I get the path for that folder from my bundle? The method I would usually use is... [[NSBundle mainBundle] pathForResource:fileName ofType:______]; ...but what "type" is a directory? Is there a...

Google Drive API VB.NET Parent Folder of a Folder

vb.net,google-drive-sdk,folder,parent
I am trying to work with Google Drive API with vb.net I have seen a lot of post but I am not able to understand how to choose the right folder to add a file. I have a lot of "Backup" folder but, I assume now, I want to add...

Using a variable as folder name in a path php

php,image,variables,path,folder
I am trying to make this listing website in PHP, and I've come to the part with the images. Every item on the site has an unique ID, and the images are saved in a folder with that id as a name. I have trouble displaying the images in a...

Tar.gz and encrypt folders

shell,folder,tar,gnupg
I have a lot of folders I'd like to backup on a remote location. I'd like to tar.gz and encrypt all of these, [if possible] in a single command line. So far, I've successfuly did half the work, with find . -type d -maxdepth 1 -mindepth 1 -exec tar czf...

Is it possible to select a folder based on it's name rather then on it's path? VBA - Outlook

vba,outlook,folder,outlook-vba
Recently I am trying to create a function which selects specific folders. I tested this at one user and it works. The problem however is that I also want to use this function at other users but not having to rewrite the function based on their folder structure. The function...

python cannot get folders to save inside of one folder

python,folder
I've run into some trouble that I believe must be an easy fix. I am currently pulling png files from one path, and saving them in a folder in another path. This is all done correctly. What I try to do after is to group those folders into one Results...

How to move folder/files with path names > 255 characters in Windows 8.1?

file,copy,windows-8.1,folder,move
I have looked around for ages, and the only possible way I have found is to use the subst method. I don't want to mess about with this. I simply want to copy/move a directory, X, to location Y. How can you copy/move a folder or file with path name...

Windows CMD command: Get subfolder name

windows,batch-file,cmd,folder
I want to make a script which copies some files from different locations. I have the next folder: C:\Test\FILES\< RANDOM_NAME >\< many_files > . In this folder, I have many files which I need later. I copy the entire directory < RANDOM_NAME > to my working directory. But later, in...

Python: Program will not run in other directory

python,directory,folder
I am running ubuntu 12.04 and running programs through the terminal. I have a file that compiles and runs without any issues when I am in the current directory. Example below, [email protected]:~/Documents/BudgetAutomation/BillList$ pwd /home/david/Documents/BudgetAutomation/BillList [email protected]:~/Documents/BudgetAutomation/BillList$ python3.4 bill.py ./otherlisted.txt ./monthlisted.txt [email protected]:~/Documents/BudgetAutomation/BillList$ Now when I go back one directory and try running...

Meteor package naming error

meteor,sass,package,folder
I've been working on a Meteor package for some time now and I have been been using a Meteor SCSS build package to compile my sass. Now for reasons like autoprefixer and such, I need to compile the SCSS outside of Meteor. My plan was to use Codekit but when...

Copying folders simply C# [duplicate]

c#,copy,folder,copy-paste
This question already has an answer here: Best way to copy the entire contents of a directory in C# 15 answers Im trying to create a simple program that to help learn c# and to be semi useful for my self and expandable. http://imgur.com/pKR6v20 I type a path into...

How can I obtain the parent of the path inside an URL object in Java?

java,url,java-ee,directory,folder
I have the following problem in a Java application By this statment I retrieve the current location of my application: URL location = Main.class.getProtectionDomain().getCodeSource().getLocation(); So for example my location contains a path like: /C:/Projects/edi-sta/out/production/edi-sta/ Ok, how can I easilly obtain the parent path? For example, considering the previous path, how...

How to create a folder in android External Storage Directory

android,folder,creation
I am new to android Development. Now I want to create a folder in android External Storage Directory. I have added permission to write external storage, Here is mu code. Manifest - Permission <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Java Code String Path = Environment.getExternalStorageDirectory().getPath().toString()+ "/AppName/Images"; System.out.println("Path : " +Path ); File FPath...

Livereload UI “Add folder” doesn't work

folder,livereload
After attaching big size folder (Desktop folder) as a project folder "Add folder" stopped working. Reinstalling didn't help. How can I solve this or what is the name of the file I should put project directiories in so there will be no need to use UI "Add folder". I am...

My outlook VBA code can't find a specific folder

vba,outlook,folder,outlook-vba
I have a sub which reads/gets the email items in a speicifc folder. When I executed it doesnt seem to find the specific folder and I have no clue why. The sub is as follows: Sub HowManyEmails() Dim objOutlook As Object, objnSpace As Object, objFolder As MAPIFolder Dim EmailCount As...

Trouble creating a folder then creating files within the folder

java,file,folder
Hi I'm having a problem creating a folder in which every file I create in my for each loop will be placed. It is a basic problem but I can't seem to see it, any help would be much appreciated! Scanner inputScan = new Scanner(System.in); System.out.println("Enter location for output folder...

JavaFX load image from external folder

java,image,javafx,path,folder
I need some help with importing Images to my JavaFx application: My image has the path : /sprinter/ExternalSprinterFolder/Maps/map_asteroid/map_asteroid.jpg My GUI code has the path: /sprinter/src/de/sprinter/gameclient/gui/SelectSectorGui.java I tried already a lot but I can't load the image... I tried for example: File file = new File(imagePath); Image image = new Image(file.toURI().toString());...

How do you get files with extension from folder in Ada95?

directory,folder,ada
I'm trying to create a function that will look for all .dll files in a specified folder, plugins. All of my web searches (Ada Directories) have work perfectly under Ada 2005, but I need a function that will work for Ada 95. It is to my knowledge that Ada 95...

Images should only load when scrolling down to reduce bandwidth [closed]

php,css,ajax,image,folder
well, i am reading out an image folder with lets say 300 images with php. It runs fine. To reduce bandwidth, i want to load the images only, if they are in the viewport....

301 Redirect directory to it's included file

.htaccess,file,redirect,folder
I have bali directory in root folder. It contains main_bali.php and other many php file . I want to redirect http://domain.com/bali/ to http://domain.com/bali/main_bali.php I use Redirect 301 bali/ bali/main_bali.php and many other tricks. but none of them works. when entering domain.com/bali in url it display domain.com/bali/main_bali.php but display internal error....

Loading images from different folders

javascript,html,css,image,folder
So I want to load different images from different folders. I have a little puzzle where you can change the format for example to 3x3, 3x4, 4x3 and 4x4 etc. and now I want that when someone clicks on "select format" and choose 3x3 it loads images from the 3x3...

How to get complete path and name of each file in Download directory in Android

android,file,folder
I am going to develop an app, where user can choose File from a Download directory. Now i need the path + name of the file, which the user has chosen. DownloadManager dm = (DownlaodManager) getSystemService(DOWNLOAD_SERVICE); By this way the user can choose the file. Now i need the absoloute...

Flattening folders programmatically

windows,file,batch-file,command-line,folder
I have a folder which contains a set of directories. I want to iterate over all directories in this root folder and, if these contain folders, flatten them (i.e put them all into the original directory, unless the folder is named "exception". So I have >Root Folder >directory >subdirectory file1...

Get assets directory from an android function name or variable instead of hard-coded

java,android,folder,android-assets
Read many questions about the location of assets. Not any of these solutions uses a function to get the assets foldername/dirname/pathname, only hard-coded like: "file:///android_asset/". For example to get a path you can do something like this: String sFilesPath = mContext.getFilesDir().getPath(); Is there a function or variable in Android to...

removing node_modules folder

windows,npm,folder,yeoman,deletion
The problem: I've created a yeoman project by mistake on my windows box. Via explorer when I try to delete it I get an error saying that the path is too long. Several Solutions: http://superuser.com/q/78434/9546 http://stackoverflow.com/a/28999343/145682 Remove complete angular project built with Yeoman But is there a script based solution?...

C# Copy file or folder

c#,file,directory,copy,folder
I am trying to write a program to keep multiple folders in sync. To do this, I need to copy and delete files and subfolders. To me, it doesn't make a difference if an object is a file or a folder, I want to create all necessary parent folders and...

VBA - Open files in folder and print names

excel,vba,file,printing,folder
I want to open all of the files in a certain folder and have it print out the names of those files. I have set up a code that opens the files but I cannot get it to print the name. I have a separate code that will print the...

Does Java listFiles().length return only files number or files+folders number

java,file,folder
I have a simple question: Does Java listFiles().length will return only files number or files+folders numbers of the folder on which it is called? It isn't explicitly stated in Java documentation and I need to know this.

wxPython. How to open a folder with wxWidget (python) hyperlink? [closed]

python,hyperlink,wxpython,folder,wxwidgets
I want to create a hyperlink in my wx widget which opens linked folder on clicking. Please help me how to build that. Thanks....

How to create folder, files in this folder, compress folder (in zip or rar file) and upload this to the desktop with Javascript?

javascript,file-upload,folder,archive
For a web application, an user must be able to export an html file with css stylesheet of choice (proposed by the application) on his desktop. A unique button for export : on click, a "Save as" dialog window appears for choose a destination on desktop. The file must have...

Can't access PHP file from another folder

php,path,folder
I am trying to access a PHP file that is located in another folder. $path = $_SERVER['DOCUMENT_ROOT']; echo $path; It's displaying: /Applications/MAMP/htdocs/mysqli I am trying to redirect to welcome_employer.php in the folder "... mysqli/employers". How can I do this? header('Location:'.$path.'/employers/welcome_employer.php'); Thanks...

From Access, how do I open a Windows Explorer folder knowing only part of the folder name?

vba,ms-access,access-vba,folder
My incomplete file path is stored in Me!txtFilePath. It contains a complete path to the folder's location and the first 9 out of ~30 characters of the folder name. Those first 9 characters are guaranteed to be unique. Currently I have a button that executes the code below when clicked:...

Java opening images for sprites

java,folder,sprite,subfolder
I am making a game that needs multiple sets of sprites and they need to be stored in a form of 2d list/array. I have 2 objects that need sprites, you (which is the guy) and bee. I have the images sorted by these 2 characters, then their actions, then...

Linux/shell - Remove all (sub)subfolders from a directory except one

linux,delete,find,folder,rm
I've inherited a structure like the below, a result of years of spaghetti code... gallery ├── 1 │   ├── deleteme1 │   ├── deleteme2 │   ├── deleteme3 │   └── full │   ├── file1 │   ├── file2 │   └── file3 ├── 2 │   ├── deleteme1 │   ├── deleteme2 │   ├── deleteme3 │  ...

Inno Setup Unknow Filename Prefix

installation,folder,inno-setup
I'm trying to set the output folder of the compiled installer to the desktop. This script can be runned by multiple people across multiple computers, that's why I need to use a dynamic script. OutputDir= "{#Desktop}" I'm able to use the prefix userdocs: but not userdesktop:. //Works: #define Path "userdocs:Visual...

Get a folder path where is missing specified file into variable

batch-file,folder,detect
Let's say I have two folders in one. MyFolder\Folder1\ - contains .class and .java file MyFolder\Folder2\ - contains only .class file The question is, if you can make the batch file detect the folder in (MyFolder) where is a .java file missing and put the path into a variable. Something...

Windows Batch create folders based on file names

windows,batch-file,cmd,folder
I want to create folders based on file names that look like this: file with words 01.wav file with words 02.wav file with words 03.wav file with more words 01.wav file with more words 02.wav ... the tree should look like this Folder |----file with words |----file with words 01.wav...

Batch-Script: Replace every [email protected] in file name with “_” in network drive including subfolders

batch-file,replace,folder,filenames
My Problem is this: I want to replace every Special character such as "@" in file names. Example: old file: [email protected] new file: test_home.txt This should be done in a special chosen Folder including subfolders. The user should easily Change the Location (Folder). Thx guys Alright Well, I will give...