I would like to ignore all the files in my dist directory with goto anywhere. Which I have accomplished with
"folder_exclude_patterns":
[
".git",
"dist"
]
However it also ignores it in the left-side project tree. Is there a way to keep it in the project tree but prevent goto anywhere from searching inside it?
Related
I'm making a project out of creating a script to use at work to automate one of our processes.
I'd like the script to check an input for username to search the specified user profile path for any files of .doc,.docx,.pdf,.pst ect. and copy them as is to a created folder on a network drive location.
My main question is what is the command or chain of commands to check folders and sub folders starting at the specified userpath, for JUST files with those extensions and I guess copy them but without getting to a situation where it just copies the same file over and over and over again. Sorry if that's confusing.
This answer provides sample code for recursively traversing a folder tree. A list of extensions could be handled by creating a dictionary:
Set extensions = CreateObject("Scripting.Dictionary")
extensions.CompareMode = vbTextCompare 'case-insensitive
extensions.Add "doc", True
extensions.Add "docx", True
extensions.Add "pdf", True
extensions.Add "pst", True
...
and then checking the extension of the processed files like this:
For Each f In fldr.Files
If extensions.Exists(objFso.GetExtensionName(f.Name)) Then
f.Copy targetFolder & "\"
End If
Next
The trailing backslash is required when the destination is a folder, otherwise you'd have to specify the full target path including the target filename.
I think I have understood most of the requirements, and this can be more easily achieved by using a .BAT file approach within windows. This batch (.Bat) file can run commands such as copy / delete etc.
So create a file called test.bat, and inside the file add the below script:
::XCOPY source [destination]
XCOPY "C:\Temp\*.doc" "C:\Temp\another"
What does this do? Well it uses an XCOPY Command to copy any files within the C:\Temp direcory which have a .doc extension. The files will be copied over to a folder called C:\Temp\another.
The XCOPY takes two primary arguments: source and destination. Source is where the file currently lives, and destination is where you want to copy the files to. More info of all of the options available can be found on:
http://support.microsoft.com/kb/240268
In order to run the file, just double click it, or schedule it to run whenever required.
Let me know if this meets your requirement, I didn't fully understand the bit about an input for a username?
I'm in document control.
I have to search two folders repeatedly.
Can windows 10 search inside of both folders at the same time?
Glenn. Thanks.
There are two options:
- search common parent folder and include only results from desired paths
- create custom search, which searches only desired paths
Let's say I have this folder structure:
.\temp\A\B\folder1
.\temp\I\J\folder2
.\temp\X\Y\folder3
where each folder contains files named fileX in FolderY.txt
Now I want to search for file1 in folder1 and folder2, but not in any other folders, like folder3
Option 1
Open folder that is common for both subfolders containing searched files. In our example it's folder temp.
And enter this search string: file1 (folder:(temp\A\B\folder1) OR folder:temp\I\J\folder2)
brackets containing OR statement is needed, and brackets around path are optional, if that path does not contain spaces.
This Option is not very optimal if the folder from which you start your search contains many files. Starting this search from C:\ will still search the whole C:\
Option 2
Firstly enter search string including any possible search options, but without folder specification:
Now click Search - Save Search and save the search to a .search-ms file
Open that file in Notepad and close to the end, there will be something like this:
<include path="::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\C:\temp" attributes="1887437183"/>
Duplicate the whole tag as many times as needed, while changing path on each to one, in which you want the search to be done.
Save the file, rename as you like, move to any place you like and use it by double-clicking on it.
This way, only specified locations are searched, which makes the search fast
in this screenshot picture, the search-ms is formatted, which is normally not. It doesn't matter if you save it formatted or minified, or if you format just the Scope element, entering each include on a new line
any search options are also saved to search-ms, like recursive search (Current Folder\All subfolders), date, or file type
you can also use <exclude path= to exclude a path location from search
you can use <include knownFolder="<GUID>" to make locations more generic and portable Known Folder IDs
More about search-ms format
I created a batch file using option 2.
It allows you to specify a search term and then generate and run an .ms-search file.
You must replace the path "C:\Folder01", "D:\Folder01", "E:\Folder01", "F:\Folder01".
#echo off
SETLOCAL enabledelayedexpansion
for /l %%x in (1, 1, 100) do (
set /p searchterm="Enter search: "
(
echo ^<?xml version="1.0"?^>
echo ^<persistedQuery version="1.0"^>
echo ^<viewInfo viewMode="details" iconSize="16"^>
echo ^<sortList^>
echo ^<sort viewField="System.DateModified" direction="descending"/^>
echo ^</sortList^>
echo ^</viewInfo^>
echo ^<query^>
echo ^<conditions^>
echo ^<condition type="leafCondition" property="System.Generic.String" operator="wordmatch" propertyType="string" value="!searchterm!" localeName="en-US"^>
echo ^</condition^>
echo ^</conditions^>
echo ^<kindList^>
echo ^<kind name="item"/^>
echo ^</kindList^>
echo ^<scope^>
echo ^<include path="::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\C:\Folder01" attributes="1887437149"/^>
echo ^<include path="::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\D:\Folder01" attributes="1887437149"/^>
echo ^<include path="::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\E:\Folder01" attributes="1887437149"/^>
echo ^<include path="::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\F:\Folder01" attributes="1887437149"/^>
echo ^</scope^>
echo ^</query^>
echo ^</persistedQuery^>
) > GeneratedMoviesSearch.search-ms
GeneratedMoviesSearch.search-ms
)
How can I copy a set of files by a specific pattern from a set of deeply structured folders recursively into another folder? Also I need to recreate the folder hierarchy from source folder in the target folder (only that folders, which contain copied files). I need to use standard Windows command-line tools.
This question looks like this one: How can I recursively copy files of a specific pattern into a single flat folder on Windows? ; but in my case I want to keep folder structure, so this script will not do this:
for /r %x in (*.dll, *pdb) do copy "%x" targetDir\
The decision is:
FOR /r %x in (PATTERN) DO
(if not exist TARGET_DIR%~px mkdir TARGET_DIR%~px) & (copy %~x c:\\TARGET_DIR%~px)
So, the "secret" is in %~px command which gives relative path of copied file, so we should create this relative path in target dir.
I'm making a project out of creating a script to use at work to automate one of our processes.
I'd like the script to check an input for username to search the specified user profile path for any files of .doc,.docx,.pdf,.pst ect. and copy them as is to a created folder on a network drive location.
My main question is what is the command or chain of commands to check folders and sub folders starting at the specified userpath, for JUST files with those extensions and I guess copy them but without getting to a situation where it just copies the same file over and over and over again. Sorry if that's confusing.
This answer provides sample code for recursively traversing a folder tree. A list of extensions could be handled by creating a dictionary:
Set extensions = CreateObject("Scripting.Dictionary")
extensions.CompareMode = vbTextCompare 'case-insensitive
extensions.Add "doc", True
extensions.Add "docx", True
extensions.Add "pdf", True
extensions.Add "pst", True
...
and then checking the extension of the processed files like this:
For Each f In fldr.Files
If extensions.Exists(objFso.GetExtensionName(f.Name)) Then
f.Copy targetFolder & "\"
End If
Next
The trailing backslash is required when the destination is a folder, otherwise you'd have to specify the full target path including the target filename.
I think I have understood most of the requirements, and this can be more easily achieved by using a .BAT file approach within windows. This batch (.Bat) file can run commands such as copy / delete etc.
So create a file called test.bat, and inside the file add the below script:
::XCOPY source [destination]
XCOPY "C:\Temp\*.doc" "C:\Temp\another"
What does this do? Well it uses an XCOPY Command to copy any files within the C:\Temp direcory which have a .doc extension. The files will be copied over to a folder called C:\Temp\another.
The XCOPY takes two primary arguments: source and destination. Source is where the file currently lives, and destination is where you want to copy the files to. More info of all of the options available can be found on:
http://support.microsoft.com/kb/240268
In order to run the file, just double click it, or schedule it to run whenever required.
Let me know if this meets your requirement, I didn't fully understand the bit about an input for a username?
I am dealing with a massive nest of files and need to find a .htaccess file that is redirecting a single page in my website. I know how ridiculous this sounds: why not just check the directories the page is located within? But the problem is slightly more complicated than that. All I need though, is to search for every .htaccess file under the web folder. Trying a normal search doesn't allow me to select that type of file to search for, and searching for hidden files has just been (who knows why) ignoring the .htaccess files anyway. I can't download any new software to do this for me. but - there must be a way! Even if I could somehow list every file within a directory (and its subdirs) and then organize by file type and scroll down?
I could search for any file with the word "RewriteEngine" , but there are so many files, this would take forever.
Any ideas?
Thanks!
=/ notepad++ is not installed, and I don't have auth to install anything
Use the commandline.
findstr /s RewriteEngine .htaccess
Searches the current directory and all sub directories for .htaccess files containing the string RewriteEngine.
Try searching for files of the form: *htaccess
(spelled precisely like that in the search field)
have you tried using Notepad++. It has a 'Find in files...' option that you could specify the page that it's trying to redirect to, and you could have it check only in *.htaccess files.
Just a thought
Search All files and folders, in All or part of the filename: put ".htaccess" including the quotes.
in the command prompt:
for hidden files: dir /s /b /a:sh *.htaccess>C:\results.txt
for non-hidden files: dir /s /b *.htaccess>C:\results.txt
to search for "RewriteEngine" type dir /s /b rewriteengine
both of these will output the search results to a text file called "results"