Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1113519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:52:17+00:00 2026-05-17T02:52:17+00:00

In a Linux or Mac environment, Vim’s glob() function doesn’t match dot files such

  • 0

In a Linux or Mac environment, Vim’s glob() function doesn’t match dot files such as .vimrc or .hiddenfile. Is there a way to get it to match all files including hidden ones?

The command I’m using:

let s:BackupFiles = glob("~/.vimbackup/*")

I’ve even tried setting the mysterious {flag} parameter to 1, and yet it still doesn’t return the hidden files.

Update: Thanks ib! Here’s the result of what I’ve been working on: delete-old-backups.vim.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:52:18+00:00Added an answer on May 17, 2026 at 2:52 am

    That is due to how the glob() function works: A single-star pattern
    does not match hidden files by design. In most shells, the default
    globbing style can be changed to do so (e.g., via shopt -s dotglob
    in Bash), but it is not possible in Vim, unfortunately.

    However, one has several possibilities to solve the problem still.
    First and most obvious is to glob hidden and not hidden files
    separately and then concatenate the results:

    :let backupfiles = glob(&backupdir..'/*').."\n"..glob(&backupdir..'/.[^.]*')
    

    (Be careful not to fetch the . and .. entries along with hidden files.)

    Another, perhaps more convenient but less portable way is to use
    the backtick expansion within the glob() call:

    :let backupfiles = glob('`find '..&backupdir..' -maxdepth 1 -type f`')
    

    This forces Vim to execute the command inside backticks to obtain
    the list of files. The find shell command lists all files (-type f)
    including the hidden ones, in the specified directory (-maxdepth 1
    forbids recursion).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 544k
  • Answers 544k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The way you had it originally was correct; you just… May 17, 2026 at 7:06 am
  • Editorial Team
    Editorial Team added an answer I don't believe there is any feasible way to accomplish… May 17, 2026 at 7:05 am
  • Editorial Team
    Editorial Team added an answer yes that is correct. If you are finding the gcd… May 17, 2026 at 7:05 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Is there a way, in Linux, Windows, or preferably Mac OS X to take
On Linux (or Solaris) is there a better way than hand parsing /proc/self/maps repeatedly
I am looking to write some C# code for linux/windows/mac/any other platform, and am
I'm building an application that is targeting Windows, Mac and Linux soon. I was
Is there a platform independent way to detect the number of physical and/or virtual
I have just come to Mac world from Linux world and I love my
Question from a Linux/Mac developer: I have compiled a 32-bit .dll (release flavor) under
I'm working on a server application that's going to work on Linux and Mac
Linux provides the stime(2) call to set the system time. However, while this will
On linux, it's possible to create a tun interface using a tun driver which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.