w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How can I copy only files and folder created in the past hour in one directory to a new directory?
Robocopy doesn't have the granularity, but XXcopy seems to handle it. /DA#30m selects files made within the last 30 minutes. XXcopy is free for non commercial use and can be downloaded from http://www.xxcopy.com XXcopy is xcopy on steroids.

Categories : Batch File

Open folder contents into directory above
I will give you a hint. Use php file_get_contents('file_dir') to read the file into a string Use php file_put_contents('file_dir') to create the file Also use php unlink('file_dir') function to delete a file if necessary If you need to remove directory, use php rmdir() function. If you do not need to access the files, you can just use php copy($source, $dest) function to copy your files from one directory to another. Then you can delete them from old directory.

Categories : PHP

Copy entire directory to output folder maintaining the folder structure?
Try XCOPY instead of COPY; e.g. XCOPY "$(SolutionDir)ResourcesTemplate" "$(TargetDir)" /s /i /y More info on XCOPY here... http://www.computerhope.com/xcopyhlp.htm

Categories : Visual Studio

Delete all files from a directory except for folder and it's contents
The problem is the way in which the recursive function calls are done: the main function private static void WalkDirectory(DirectoryInfo directory) deletes all files and is called every time (even while analysing a subdirectory). Here you have a fix to make this code work as you wish: private static void WalkDirectory(DirectoryInfo directory) { if (directory.Name.ToLower() != "data") { // Scan all files in the current path foreach (FileInfo file in directory.GetFiles()) { file.Attributes &= ~FileAttributes.ReadOnly; var name = file.Name; name = name.ToLower(); if (name != "test.txt") { file.Delete(); } } DirectoryInfo[] subDire

Categories : C#

copy directory from assets to data folder
try this code of your Application instance (you should write the class in manifest): This code is copying content of assets/files folder to the cache folder of app (you can place other path in copyAssetFolder() function). Only when App is launched for the first time import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import android.app.Application; import android.content.Context; import android.content.res.AssetManager; import android.preference.PreferenceManager; public class MyApplication extends Application { private static Context s_sharedContext; @Override public void onCreate () { super.onCreate(); if (!PreferenceManager.getDefaultSharedPreferences(

Categories : Java

Shell Script to copy all files in a directory to a specified folder
I guess this what you are looking for : #!/bin/bash dir=$(cat a.txt) for i in $(ls -l|grep -v "^[dt]"|awk '{print $9}') do cp $i $dir/$i"_"$(date +%Y%m%d%H%M%S) done I assumed that a.txt contains only the name of the destination directory. If there are other entries, you should add some filter to the first statement(using grep or awk). NB: I used full time stamp(YYYYMMDDHHmmss) instead of your YYYYMMDDmmss as it doesn't seem logical.

Categories : Shell

Copy Folder from main bundle to documents directory in iphone
Are you sure that you have the files in your folder tree? NSString *defaultDBPath1 = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"/Images/Images1"]; usually when xcode make a package it flatten the directory contents. So first check you have all the things in your source folder. Even if you see that the folder is shown in your package explorer, when copied in the app, you will see the images are in the root folder. To avoid this, when you add the Image folder, in your xcode project, you can check the option to 'create folder reference'. However, your write may fail because of an overwrite. In that case you have to implement a delegate method for NSFileManager given below. - (void) copyFolder { BOOL success1; NSFileManager *fileManager1 = [NSFileManag

Categories : IOS

Makefile: copy perl/python files from source directory into build directory
Basically, when you run make X, you are telling Make to find target X in your Makefile. So if you have no install: target, nothing will happen. All of this really depends what is in your Makefiles. If you want to copy your perl/python files into the build directory, one way to do so is to write a Makefile target that runs a *sh command like mv dir2/*.pyc build; mv dir2/*.pl build, and require that target somewhere else in your Makefile. If you need a good Makefile tutorial, here's one that I started with.

Categories : C++

phing - delete directory contents without directory itself
I have just tried it myself and the same code would not delete the include folder. Only way to make it do so was to set the includeemptydirs to true. Maybe it's a version problem, but still, I would try calling it like this: <delete> <fileset dir="folder" casesensitive="false" includeemptydirs="false"> <exclude name="excluded.php"/> </fileset> </delete>

Categories : PHP

Visual Studio: How to "Copy to Output Directory" without copying the folder structure?
Keep them in $(ProjectDir)Lib, but add those files "As a link" to the root of your csproj. Now they will get copied to binDebug (or whatever other output folder) without being in lib.

Categories : C#

Copy files from source directory to target directory and exclude specific file types from specified directories
This is one way to do it $SourceDirectory = 'C:Source' $DestinationDirectory = 'C:Destination' $ExcludeExtentions = '*.txt*', '*.xml*' $ExcludeSubDirectory = 'C:Sourcead_directory1', 'C:Sourcead_directory2' Get-ChildItem $SourceDirectory -Recurse -Exclude $ExcludeExtentions | Where-Object { $ExcludeSubDirectory -notcontains $_.DirectoryName } | Copy-Item -Destination $DestinationDirectory Your best friend here is Where-Object, or where. It takes a scriptblock as parameter and uses that scriptblock to validate each object that goes through pipeline. Only objects that make script return $true are passed through Where-Object. Also, take a look at the object that represents a file you get from Get-ChildItem. It has Name, Directory and DirectoryName containing pieces of file's FullNam

Categories : File

Avoiding a customized Copy Directory function to go on infinite loop when copying folder into himself
This is a case where recursion doesn't really work, as the list of directories and files always changes as you copy. A better solution is to get the list of all files and folders in advance. You can get all files and directories in a tree using the Directory.GetFiles(String,String,SearchOption) and Directory.GetDirectories(String,String,SearchOption) with SearchOption set to SearchOption.AllDirectories. These will return all files and all directories respectively. You can follow these steps to copy the files: Get the list of all source directories and sort them in ascending order. This will ensure that parent directories appear before their child directories. Create the target directory structure by creating the child directories in their sorted order. You won't get any path conflicts

Categories : C#

How to add a file thats copied from one directory to a folder in another directory thats incremented
I would recommend using time stamps rather than sequential numbering. Also here is everything in one command and it is user independent. @xcopy "%LocalAppData%GoogleChromeUser DataDefaultookmarks*" "%UserProfile%DesktopBackup of Bookmarks\%Date:~10,4%-%Date:~4,2%-%Date:~7,2%" /I /Y This will copy both the bookmarks and bookmarks.bak file to a time-stamped folder inside the Backup of Bookmarks folder.

Categories : Batch File

How to copy entire directory into another directory using maven?
You can use the Maven ressources plugin. As an example taken from their documentation: <project> ... <build> <plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>copy-resources</id> <!-- here the phase you need --> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/extra-resources</outputDirectory> <resources> <resource>

Categories : Maven

How to copy/cut file(s) from one directory and sub directory and paste into another
Here you can find everything you need: http://docs.python.org/3/library/shutil.html Copying whole directory: shutil.copytree(src, dst, symlinks=False, ignore=None) Deleting whole directory: shutil.rmtree(path[, ignore_errors[, onerror]]) Moving directory: shutil.move(src, dst) Example code, that does what you want: import shutil shutil.copytree("C:UsersDesktop est", "C:UsersDesktop ew_test")

Categories : Python

How to copy pictures from directory and subdirectory to another directory?
You have private String path; private File[] images = new File("C:/Users/Public/Pictures/Sample Pictures"+"/").listFiles(); so at start path is null. Now you need to know that fields are initialized before constructors code, so if you change images to new File(path+"/").listFiles(); it will be the same as changing it to new File(null+"/").listFiles(); so it will produce new File("null/").listFiles(); To solve that problem try invoking images = new File(path+"/").listFiles(); when path will be set to correct value, so probably after getPath method.

Categories : Java

How to copy file from directory to another Directory in Java
Use Apache Commons FileUtils FileUtils.copyDirectory(source, desc);

Categories : Java

How to find, filter and copy directory and contents to a location dictated by part of find result ) in Powershell
This should work: $specialdirectory = "xyz" $Destination = "zyx" $1 = "\fileserverprofiles" | Get-ChildItem $User = $1.Name | where {$_ -Match "User"} $User | foreach { $check = test-path -pathtype Any "\fileserverprofiles$_appdata$Specialdirectory" If ($check -eq $true) {Copy-Item \fileserverprofiles$_appdata$specialdirectory -Destination C:$Destination -Recurse} }

Categories : File

How do i copy files from one directory to another directory?
You are doing it the right way.. See example from microsoft http://msdn.microsoft.com/en-us/library/bb762914.aspx another solution might be to call the xcopy command ...

Categories : C#

Copy file from Application document directory and move to iPhone /Application folder- Objective C?
I believe you mean /Applications instead of /root/Applications since there is no such folder (at least not on my iOS 5 device). Since /Applications folder has is owned by root with 755 permissions. That means, non-root users can read/execute the files in that folder but not write to it. If you want to write to that folder, you need to run your app as root. The way to do this, somewhat ironically for you, is to have the app installed in /Applications folder. (I think) this is automatically done if you install the app through Cydia. So to sum up: You can't move app to /Applications if you installed it through App Store (or ad hoc distribution). You need to install it through Cydia and it'll be installed directly in that folder. Also, that answer you're referring to in comments, is about M

Categories : Iphone

Using batch files to copy all files from a directory tree to a single directory
@echo off set "COPY_FROM=C:UsersmeDesktopDisc 1" set "COPY_TO=C:Testing est" md "%copy_to%" 2>nul cd /d "%COPY_FROM%" for /f "delims=" %%a in ('dir /b /s /a-d') do copy "%%a" "%COPY_TO%" pause

Categories : Batch File

Automatically copy contents of FTP folder to local Windows folder without overwrite?
Use wget for Windows. If you want to include subdirectories (adjust the cut-dirs number according to the depth of your actual remote path): cd /d C:MyDestination wget.exe --mirror -np -nH --cut-dirs=2 ftp://UserName:Password@MyFtpServer.com/var/MyFolder If you don't want subdirectories: cd /d C:MyDestination wget.exe -nc ftp://UserName:Password@MyFtpServer.com/var/MyFolder/* The "magic" bit (for this second form) is the -nc option, which tells wget not to overwrite files that are already there locally. Do keep in mind that old files are also left alone, so if a file on your FTP server gets edited or updated, it won't get re-downloaded. If you want to also update files, use -N instead of -nc. (Note that you can also type wget instead of wget.exe, I just included the extension to poi

Categories : Shell

Use Sharepoint Copy web service to copy folder and contents
There is a simple solution to this problem , as its just about copy and paste use the simple XCOPY command XCOPY Copy files and/or directory trees to another folder. XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail. To copy a folder including all subfolders XCOPY C:utils* D:Backuputils /s /i here /i defines the destination as a folder for more detail please refer this link

Categories : C#

How to access a file in a directory from other directory, when both are in same parent directory with HTML
if dir1 and dir2 are in the same parent directory then this is how you access 2.html from 1.html: <a href="../dir2/2.html">link to 2.html</a> hope it helped :)

Categories : HTML

application Support folder doest not iphone folder while creating a directory
make sure you're not searching for it because you will get the wrong application folder, you have to go to your "user name" folder and make it show hidden files and that will show the hidden library file so you can start navigating your way to that address... try that and anymore issues with it ill try and help further.

Categories : Objective C

How to change the current working directory to a specific directory and execute a program under the specific directory?
One of your principal problems is that you don't capture the return value (output) of the command in backticks. You are merely throwing away the output you want. Do something like: my $output = `perl ./script.pl` system("perl ./script.pl")

Categories : Perl

Is there a way to read contents of a directory from web app
You cannot access file system of user machine from pure web application. This task can be implemented using trusted applet or java application executed via java web start or trusted flash component or other native component (browser plugin). Applets are almost obsolete and require JVM on client side. Java web start still requires JVM. All signed components (java based, flash, native code) require user approval. I think that better and more modern way is to use a great feature of HTML 5 that allows not navigation to specific location on disk (that was possible since HTML 1.0) but also selecting a full directory. Take a look on the following discussion for details: Does HTML5 allow drag-drop upload of folders or a folder tree?

Categories : Java

PHP Zip: Extract contents of a directory
I managed to get it to work by working with file streams manually instead of using extractTo(). The script extracts all the files in the base of the archive and all the files in directories in the base of the archive in to the output folder. For example, if this is the archives contents: - d0001 - My Folder - view.php - tasks.txt - file1.txt - picture1.png - document.doc - d2 - another1.png - pic2.gif - doc1.txt - mylist.txt The contents of the output directory will look like this: - My Folder - view.php - tasks.txt - file1.txt - picture1.png - document.doc - another1.png - pic.gif - doc1.txt - mylist.txt The code: function rrmdir($dir, $removebase = true) { if(is_dir($dir)) { $objects = scandir($dir); foreach($objects as $object) {

Categories : PHP

Cocoa contents of directory
Lets just take 1 of your 3: [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"directoryName" error:nil] You should include the error parameter and check what it contains You need to supply a full path, not just a "directoryName" As a result you'll get an array containing the file names of the files in the directory So if you want the full path you can do: NSString *directoryPath = ...; NSArray *fileNames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryPath error:...]; for(NSString *fileName in fileNames) { NSLog(@"%@", [directoryPath stringByAppendingPathComponent:fileName]); }

Categories : Objective C

How to add the contents of a directory to a zip file?
Python's zipfile module allows you to manipular ZIP compressed archives. The ZipFile.namelist() method returns a list of files in an archive, and the ZipFile.write() method lets you add files to the archive. z = zipfile.ZipFile('myfile.zip') The os.walk method allows you to iterate over all the files contained in a directory tree. for root, dirs, files in os.walk('mydir'): for filename in files: z.write(os.path.join(root, filename)) Replacing a file in an archive appears to be tricky; you can removed items by creating a temporary archive and then replacing the original when you're done as described in this question. It might be easier just to call the zip command instead, but put these together and you should be able to get to where you want.

Categories : Python

copy contents of a folder from one location to another using ruby
FileUtils#copy_entry will be the good choice for this thing. Copies a file system entry src to dest. If src is a directory, this method copies its contents recursively. This method preserves file types, c.f. symlink, directory... (FIFO, device files and etc. are not supported yet)

Categories : Ruby

Ruby: Copy contents of folder in zipfile
If you don't mind using Linux unzip and really aren't worried about subdirectories: def unzip(file) to = File.join(File.dirname(file), File.basename(file, ".*")) Dir.mkdir(to) unless File.exists?(to) `unzip -j #{file} -d #{to}` end # unzip('yourfile.zip') This method creates a new directory in the same directory as the zip file with the same name as the zipfile (minus extension). It then extracts (using unzip) the zip file into that directory, ignoring all paths (the -j flag tells unzip to junk paths). EDIT Per your comment, here is a way to do it without system calls: def unzip(file) Zip::ZipFile.open(file) do |zipfile| to = File.join(File.dirname(file), File.basename(file, ".*")) FileUtils.mkdir(to) unless File.exists? to zipfile.each do |f| if f.file? # D

Categories : Ruby

Cannot see contents of directory with local Apache
Have you added the directive in Apache2.2confhttpd.conf <Directory "C:ApacheHtDoc"> Options Indexes FollowSymLinks Order Allow,Deny Allow from All </Directory> If you haven't, add that and restart apache. Edit Path for the httpd.conf may vary according to your install.

Categories : Windows

Copy folder & contents from inside zip into another location with QuaZIP?
Logically, you could extract the files you want to copy to a temporary location on your hard disk and then copy them back to your zip file in the new location. After you copy to the new location from the temporary location, you can delete your temporary files. I think this is what many file compression tools do for file manipulation. Theoretically, you could copy the files to memory and then add them from memory into the new location in your zip file, but this could be dicey for larger files that won't fit in RAM. I would let the operating system handle the buffering to/from disk and not try to implement your own.

Categories : C++

Dos Batch Script to copy contents of one folder into another using wildcards
If you want to copy subfolders with xcopy you need option /s for subdirectories. You can not use wildcard in cd command though, but you can do a dir /b Jamie* and use this inside the for loop as you do for delete to use as target for cd.

Categories : Batch File

Delete folder contents and copy new files in batch
You should use quotes, because there are embedded spaces in the directory name: xcopy "c:New Folder(2)*.*" "c:New Folder" /C /S /D /Y /I (I didn't check the options: /C /S etc).

Categories : Batch File

Powershell download entire directory contents
Unless PowerShell is a requirement, using wget would be an easier way to mirror something like that: wget --mirror --no-parent --accept=tif http://gisdata.nd.gov/NAIP/2012/zGeoTiffs/

Categories : Powershell

Reading directory contents in variable in qshell
There is no need to use arrays here. Just use the output of ls ls -1 /user/test | grep -v '^d' | while read i do echo "$i" done

Categories : Unix

Invalid project contents directory error
After using chown command on my www folder recursively, the problem was gone. I think the problem was that eclipse can't create new files inside those folders. (Duh!) So: sudo chown -R /var/www user:group

Categories : PHP

Is it possible to transfer the contents of a whole directory using the built in Ruby Net::FTP class?
First, get all files and subdirectories in your directory: entries = Dir.glob('my_dir/**/*').sort (sort is required to ensure that every directory goes before its files) Now you can upload all files and create all subdirectories: Net::FTP.open(ftp_server, username, password) do |ftp| entries.each do |name| if File::directory? name ftp.mkdir name else File.open(name) { |file| ftp.putbinaryfile(file, name) } end end end I had no time to test this, so I could miss something.

Categories : Ruby



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.