directory

check if a folder is open (vba)

余生颓废 提交于 2019-12-25 08:58:57
问题 I am trying to check whether a specific folder is open or not using VBA . I have found this code: Sub test1() Dim OpenFold As Variant Dim oShell As Object Dim Wnd As Object Dim strFolder OpenFold = "mysubfolder" strFolder = "U:\myfolder\" & OpenFold Set oShell = CreateObject("Shell.Application") For Each Wnd In oShell.Windows If Wnd.Document.Folder.Self.Path = OpenFold Then 'this is where it gives me the error Exit Sub ' Folder is open - exit this Sub End If Next Wnd Application.ThisWorkbook

Move a directory across a network using c#

半城伤御伤魂 提交于 2019-12-25 08:57:27
问题 I have a folder A, I want to move it from my computer to a server on the network. I've tried Directory.Move(A,Server) but because they don't have the same root it does not work. File.Copy(A,Server) won't work as the folder is read only and can't change permissions. Thanks in advance. EDIT inculding code string copyFrom = @"folder"; string copyTo = @"\\server\Libraries\Documents"; string destinationPath = Path.Combine(copyTo, Path.GetFileName(copyFrom)); File.Copy(copyFrom, destinationPath);

Check for File in multiple directories with an IF statement Powershell

大兔子大兔子 提交于 2019-12-25 08:08:05
问题 I am facing some problems in powershell. I want to be able to let a powershell command search for multiple directories. With the name being a variable like "$VM_DISK=VM_DISK.vhdx" and let powershell search in that manor so that if that file exists in a folder such as C:\VM_DISK\ it exit the script. I have already tried the "Get-Childitem" but it doesn't seem to work when I put my variable in it. Here is an example: $VM_DISK= "Example.vhdx" $search=Get-ChildItem -Path C:\VM_DISK\* -Filter $VM

Rails 3: undefined method messages for Folder

≡放荡痞女 提交于 2019-12-25 08:04:23
问题 I'm running Rails 3 and like to have a message system. Here is the tutorial for it: http://www.novawave.net/public/rails_messaging_tutorial.html It's for Rails 2 so I was trying to implement it in Rails 3. Everything went fine and i can send messages. But when i like to check my inbox this error shows up: undefined method `messages' for #<Folder:0x0000010419fd48> Mailbox Controller: class MailboxController < ApplicationController def index redirect_to new_session_path and return unless logged

How to dynamically get the directory of the file running

依然范特西╮ 提交于 2019-12-25 07:37:21
问题 I am trying to switch between pages from multiple directories, what I have currently is right but once I have +300 HTML pages, I can't have it like this: window.addEventListener('load', leftNav, false); var x = location.pathname; alert(x); function leftNav() { appendUl('leftNav', 'outerUL'); appendLiA('outerUL', 'offers', '/Ofertas/offers.html', 'Offers'); appendLiA('outerUL', 'mobilecarriers', '/Ofertas/mobilecarriers.html', 'Mobile Carriers'); appendLiA('outerUL', 'affilpixeltracking', '

How to sort by date using PHP opendir()

↘锁芯ラ 提交于 2019-12-25 07:36:58
问题 I have a directory full of files that I am trying to echo out. If the file is an image, the image itself is echoed out. If the file is not an image, the name of the file is echoed out. This code below works perfectly however I can't seem to get the order sorted by date. The files are randomly echoed out. How would I make it so that the files are sorted by last modified (latest first). <?php $blacklist = array("index.php"); $ext = pathinfo($files, PATHINFO_EXTENSION); if ($handle = opendir('.'

Search through directories for specific Excel files and compare data from these files with inputvalues

99封情书 提交于 2019-12-25 07:34:31
问题 The task: The firm I have gotten a summer-job for has an expanding test-database that consists of an increasing number of subfolders for each project, that includes everything from .jpeg files to the .xlsx's I am interested in. As I am a bit used to Python from earlier, I decided to give it a go at this task. I want to search for exceldocuments that has "test spreadsheet" as a part of its title(for example "test spreadsheet model259"). All the docs I am interested in are built the same way

Renaming all files in the folder

痴心易碎 提交于 2019-12-25 07:27:29
问题 How to rename all files in the folder using Windows batch? Basically, the part of the name starting from _Done should be removed: some_file_name_Done_34534576456.CSV -> some_file_name.CSV some_other_file_name_Done_23232343.CSV -> some_other_file_name.CSV 回答1: Try this, solution in Batch: @echo off &setlocal enabledelayedexpansion FOR %%i in (*.*) do call:process "%%~i" GOTO :eof :process set "fname=%~n1" set "tname=%fname:*_Done=%" if "%fname%"=="%tname%" echo %~1: nothing to do&goto :eof set

Get all files in a directory and all the files under all subdirectories

邮差的信 提交于 2019-12-25 06:44:22
问题 I'm having a little problem getting all the files under all folders and sub directories.. And keep the path.. Here is my code at this moment.. This should go through everything right? All sub directories and everything? private List<String> DirSearch(string sDir) { List<String> files = new List<String>(); try { foreach (string f in Directory.GetFiles(sDir)) { files.Add(f); } foreach (string d in Directory.GetDirectories(sDir)) { files.AddRange(DirSearch(d)); } } catch (System.Exception excpt)

How to save only zip files and remove other folders using java?

﹥>﹥吖頭↗ 提交于 2019-12-25 06:39:26
问题 Here i have Folder(Books)in that i have 3 sub folders named: sub1, sub2, sub3 and sub1 have 2 files , sub2 have 3 files , sub3 have 4 files . And sub1.zip , sub2.zip and sub3.zip . I want to keep only zip files and delete sub1, sub2, sub3 folders of Books. With my code I'm able to delete all inside files of sub1 folder, sub2, sub3 finally all folders becoming empty, then how can I delete sub1,sub2 and sub3 folders . public void SaveZipFiles(File destwithouAudio) throws IOException { File[]