Perforce ignore subdirectories with p4ignore - perforce

I have a .p4ignore file and it does the job for the most part but I am trying to ignore certain subfolders but it does not seem to work.
# Ignore .meta, csproj files at the moment
*.meta
.DS_Store
# Ignore these folders
Data
Library
obj
# Ignore these subfolders
Resources/Subfolder1
Resources/Subfolder2
The resources folder is in the same directory as the .p4ignore yet it still checks out Subfolder1 and Subfolder2 into the changelist. It ignores Data, Library and obj. What am I missing?

In my experience, you need to append /** in order to get Perforce to ignore the contents of a directory, so in your example:
Resources/Subfolder1/**
Resources/Subfolder2/**

Related

How to ignore all files of a folder or only folders in tailwindcss?

I am using tailwindcss. In tailwind.config.js file, I found a content option. When I used ./**/*.{html,js} in this option, It also search for node_modules directory. But I want to ignore that directory. Now what to do?
The syntax **/something is called glob pattern, a way to match multiple paths at once.
** matches every subfolder, so if you want to exclude something I'd recommend include everything inside the src folder, instead of trying to exclude some other folder, like so:
./src/**/*.{html,js}
More on glob patterns here

How to allow files in p4ignore

I want to ignore all files whithin the Binaries folder except dll files in that folder.
# Ignore all files and folders
Binaries/*
# Dont ignore dll files
!Binaries/*/*.dll
With this, all files and folders get ignored. Even dll files.
But i want to allow dll files. For example
Binaries/Win64/someName.dll
Should NOT be ignored.
Please help. P4 ignore file name is ".gitignore"
I think you want:
# Ignore everything under Binaries except .dll files
Binaries/
!Binaries/**.dll
Testing this out gets me:
C:\Perforce\test>p4 add -n Binaries/foo
//stream/main/Binaries/foo#1 - opened for add
c:\Perforce\test\Binaries\foo - ignored file can't be added.
C:\Perforce\test>p4 add -n Binaries/Win64/someName.dll
//stream/main/Binaries/Win64/someName.dll#1 - opened for add
which seems correct for your use case.

Can't get into a directory

for file in os.listdir(r'C:\Users\user\Downloads\plant_tomato_leaf_dataset\plantvillage'):
for cl in os.listdir(r'C:\Users\user\Downloads\plant_tomato_leaf_dataset\plantvillage\\'+file):
print(file)
print(cl)
print('******************')
I have a folder "plantvillage". Inside that folder I have 10 folder. I have to access all the sub-folders and perform operations on those sub-folder-items. But this code is showing only items of the first folder
You might be interested in os.walk instead of os.listdir. listdir is not recursive.
An example would be:
for root, dirs, files in os.walk(r'C:\Users\user\Downloads\plant_tomato_leaf_dataset\plantvillage'):
for file in files:
print(os.path.join(root,file))
this will run the inner loop as many times as there are directories, and will also check to make sure that each file is actually a file. If you want to look at the directories themselves for some reason (ignoring files), you can do that like so:
for root, dirs, files in os.walk(r'C:\Users\user\Downloads\plant_tomato_leaf_dataset\plantvillage'):
for directory in dirs:
print(os.path.join(root,directory))
but don't try to mix and match. Getting the current directory is easy when iterating files. It's just root.

Remove .svn files from zip file

I would like to remove all svn directories from a zip file. Can not find correct pattern. This is the pattern I tried ".svn/*"
Was able to remove all .class files.
Found pattern. Should work for any directory.
"/.svn/"
Avoid the problem in the first place. Don't create your zip file directly from your working copy. Just use svn export to create a new directory without the .svn directories, and without any unversioned files, and zip that instead.

Wget - output directory prefix

Currently I try to use:
"wget --user=xxx --password=xxx -r ftp://www.domain.com/htdocs/"
But this saves output files to current directory in this fashion:
curdir/www.domain.com/htdocs/*
I need it to be:
curdir/*
Is there a way to do this, I only see a way to use output prefix, but i think this will just allow me to define directory outside current dir?
You can combine --no-directories if you want all your files inside one directory or --no-host-directories to have subdirectories but no subdirectories per host with your --directory-prefix option.
2.6 Directory Options
‘-nd’
‘--no-directories’
Do not create a hierarchy of directories when retrieving recursively. With this option turned on, all files will get saved to the current directory, without clobbering (if a name shows up more than once, the filenames will get extensions ‘.n’).
‘-nH’
‘--no-host-directories’
Disable generation of host-prefixed directories. By default, invoking Wget with ‘-r http://fly.srk.fer.hr/’ will create a structure of directories beginning with fly.srk.fer.hr/. This option disables such behavior.
‘-P prefix’
‘--directory-prefix=prefix’
Set directory prefix to prefix. The directory prefix is the directory where all other files and subdirectories will be saved to, i.e. the top of the retrieval tree. The default is ‘.’ (the current directory).
(From the wget manual.)

Resources